将误差线添加到gnuplot中的直方图 [英] adding error bar to histogram in gnuplot
问题描述
我有一个看起来像这样的数据文件
I have data file which looks like this
#col 1 2 3 4 5 6 7
#bench #these are max and min values
#mark #bar1 #bar2 #for the prevoius 2 values
NOSHARE.2 43032 139412 100 45000 130000 140000
FALSE_SHARE.2 7035 24101 5000 7500 24100 25000
SHAREDVAR.2 11316 10248 10000 12000 10000 12000
我能够使用gnuplot生成一个像这样的图形
I am able to generate a graph using gnuplot which looks like this
我需要将最大值和最小值作为错误栏添加到每个栏
I need to add max and min value as an error bar to each bar
这里是我的gnuplot脚本
Heres my gnuplot script
set output "truevsfalse.png"
set title " TRUE VS FALSE SHARING "
set boxwidth 0.9 absolute
set style fill solid 1.00 border lt -1
set key inside right top vertical Right noreverse noenhanced autotitles nobox
set style histogram clustered gap 5 title offset character 0, 0, 0
set datafile missing '-'
set style data histograms
set xtics border in scale 0,0 nomirror rotate by -45 offset character 0, 0, 0
set xtics norangelimit
set ylabel "NUMBER OF SHARING"
set xlabel "BENCHMARK"
plot 'truevsfalse.dat' using 2:xtic(1) title "true(synced and nonsynced)sharing (both vcpus)" , '' u 3 title "false sharing (both vcpus)"
我尝试过
plot 'truevsfalse.dat' using($0- .05):2:4:5:xtic(1) with boxerrorbars title "true(synced and nonsynced)sharing (both vcpus)" , '' using ($0+0.25):3:6:7 with boxerrorbars title "false sharing (both vcpus)"
但是失败了,我只是得到了没有直方图条的误差线,或者如果我尝试了一点修改,图像就损坏了.
我在做什么?
But failed , I either get just the error bars without histogram bars or if I try to modify a bit the image corrupts.
What am I doing wtong?
谢谢
推荐答案
基本上,您需要叠加直方图和误差线图,但是,我看到问题出在使用xtic(1)
,这使得很难叠加误差线图在箱形图上.
Basically, you need to overlay histogram and error bar plot, however, I see the problem is using xtic(1)
, which makes it difficult to overlay error bar plot on the box plot.
set xtics ('NOSHARE.2' 0, 'FALSE_SHARE.2' 1, 'SHAREDVAR.2' 2)
set bs 0.2 # width of a box
plot 'junk' u ($0-bs/2):2:(bs) w boxes title "true(synced and nonsynced)sharing (both vcpus)", \
'junk' u ($0-bs/2):2:4:5 w yerror notitle, \
'junk' u ($0+bs/2):3:(bs) w boxes title "false sharing (both vcpus)", \
'junk' u ($0+bs/2):3:6:7 w yerror notitle
这篇关于将误差线添加到gnuplot中的直方图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!