问题
I have the following data
Name Value of the bar Confidence interval
A 0.62 [0.59 0.63]
B 0.64 [0.54 0.72]
C 0.51 [0.46 0.67]
D 0.33 [0.25 0.36]
I tried to plot it as a bar chart with A,B,C and D labeling each bar and with and error bar.
By using
plot "my.dat" using 1; with boxes
I only get a bar chart. Can someone help me?
回答1:
If you also want errorbars, you must add a second plot with the yerrorbars
plotting style. The brackets aren't very handy in the data file, so I remove them with a sed
command:
set style fill solid
set boxwidth 0.8
set yrange [0:*]
unset key
plot "< sed 's/[][]//g' my.dat" using 0:2:xtic(1) with boxes, \
'' using 0:2:3:4 with yerrorbars lc rgb 'black' pt 1 lw 2
来源:https://stackoverflow.com/questions/24871941/gnuplot-bar-chart-with-error-bars