使用CSV标题的Gnuplot多列绘图 [英] Gnuplot multi column plot using CSV headings

查看:61
本文介绍了使用CSV标题的Gnuplot多列绘图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力获取多列条形图/直方图,并在输入时将其作为带有标题的CSV格式.以及显示{wcfiles,wclines,clocfiles,cloclines}属性的键.

I'm struggling to get a multi-column bar chart / histogram going with my input as a CSV with headings. As well as the key showing the {wcfiles,wclines,clocfiles,cloclines} attributes.

$summary << EOD
browser,wcfiles,wclines,clocfiles,cloclines
webkitgtk-2.28.2,19472,4710385,18620,3120740
firefox-78.0.1,289298,43627834,240137,24371602
chromium-83.0.4103.116,420343,100340817,269434,49597826
EOD
set datafile separator ','
set yrange [0:*]      # start at zero, find max from the data
set style fill solid border -1
set ytics format "%.0s%c" #  will generate labels 100k 200k 300k ... 1M
set title 'sloc the Web'
plot '$summary' using 0:2:($0+1):xtic(1) with boxes lc variable,\
   "" u 3 title "wclines",\
   "" u 4 title "clocfiles"

推荐答案

检查@Ethan提到的示例. 在您的情况下,您应该set logscale y,否则将很难可视化具有几个数量级差异的值.

Check the examples @Ethan mentioned. In your case you should set logscale y, otherwise it will be difficult to visualize values with differences of several orders of magnitude.

代码:

### histogram clustered
reset session

$Data <<EOD
browser,wcfiles,wclines,clocfiles,cloclines
webkitgtk-2.28.2,19472,4710385,18620,3120740
firefox-78.0.1,289298,43627834,240137,24371602
chromium-83.0.4103.116,420343,100340817,269434,49597826
EOD

set datafile separator ','
set title 'sloc the Web'

set yrange [1000:*]
set logscale y
set ytics format "%.0s%c"

set style data histogram
set style histogram cluster gap 1
set style fill solid border -1
set boxwidth 0.9

plot $Data u 2:xtic(1) ti col,\
     '' u 3 ti col,\
     '' u 4 ti col
### end of code

结果:

这篇关于使用CSV标题的Gnuplot多列绘图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆