【发布时间】:2020-03-21 23:42:13
【问题描述】:
我想在我的直方图中添加从 0 开始的误差线。
这就是我目前制作条形图的方式:
set style histogram clustered
unset title
set xlabel "X"
set ylabel "Y"
set boxwidth 1
set style fill solid
set term png
set output "figure.png"
plot [-0.5:4.5][0:10] "data.dat"using 2:xtic(1) title "Title 1" with histograms fillstyle pattern 1, \
"" using 3 title "Title 2" with histograms fillstyle pattern 2, \
"" using 4 title "Title 3" with histograms fillstyle pattern 3
我可以在我的 data.dat 文件中添加第 4 列,其中包含误差线的高度,但我不知道绘制它的正确方法。
编辑:
set style fill solid 1.0
w = 0.15
set boxwidth 0.3
set key top right
set xlabel "X"
set ylabel "Y"
set xrange[0.5:5.9]
set yrange[0:300]
set xtics 1
plot "data.dat" u ($1-w):2 w boxes lc rgb "read" ti "Title 1", \
'' u ($1+w):3 w boxes lc rgb "green" ti "Title 2", \
'' u ($1+w*3):4 w boxes lc rgb "blue" ti "Title 3", \
'' u ($1-w):5 w impulses dt 3 lw 3 lc rgb "black" ti "Title 4", \
'' u ($1-w):5 w p pt 7 ps 1 lc rgb "black" not, \
'' u ($1+w):6 w impulses dt 3 lw 3 lc rgb "black" not, \
'' u ($1+w):6 w p pt 7 ps 1 lc rgb "black" not, \
'' u ($1+w*3):7 w impulses dt 3 lw 3 lc rgb "black" not, \
'' u ($1+w*3):7 w p pt 7 ps 1 lc rgb "black" not, \
'' u 0:(NaN):xtic(1) not
【问题讨论】:
标签: gnuplot