条形图和yerrorlines在一个单独的情节中

时间:2017-01-19 22:36:33

标签: gnuplot confidence-interval

我对条形图和yerrorlines有疑问。我如何将它们一起绘制?我想绘制一个这样的图表:

enter image description here

但是,我无法得到它。

plot "data.file" using 2:xticlabels(1) title 'Scheme 1', \
     "data.file" using 3 title ' Scheme 2', \
     "data.file" using 4 title ' Scheme 3',\
     "data.file" using 0:2:5:6 title 'Confidence Interval for Scheme 1' with yerrorlines,\
     "data.file" using 0:3:7:8 title 'Confidence Interval for Scheme 2' with yerrorlines,\
     "data.file" using 0:4:9:10 title 'Confidence Interval for Scheme 3' with yerrorlines

绘图功能

{{1}}

第5列和第6列包含第2列中数据的置信区间值。 第7列和第8列包含第3列中数据的置信区间值。 第9列和第10列包含第4栏中数据的置信区间值。

1 个答案:

答案 0 :(得分:0)

您可以尝试这样的事情:

set terminal pngcairo
set output "witherrorbars.png"

set yrange [0:]

set bars 2

set style data histogram
set style histogram errorbars gap 1 lw 1
set style fill solid border -1

plot "data.file" using 2:5:6:xtic(1) title 'Scheme 1' lc 5, \
     "data.file" using 3:7:8         title 'Scheme 2' lc 7, \
     "data.file" using 4:9:10        title 'Scheme 3' lc 9

有趣的行是set style histogram errorbars,它结合了框和错误栏。这是gnuplot 4.6的结果:

boxes with errorbars

颜色lc 5lc 7lc 9是随机选择的,因此请根据您的需要进行调整。线set bars 2放大了条形末尾的抽搐。