如何使用gnuplot使图例错误符号垂直而不是水平? set key vertical
未达到预期效果:
set key vertical
plot "file.txt" using 1:2:3 with yerrorbars
答案 0 :(得分:1)
正如问题评论中Christoph所示,没有内置方法可以更改图例中errorbars的方向:xerrorbars,yerrorbars并且xyerrorbars都是水平的。
要获得垂直误差线,可以考虑禁用图例(unset key
)并使用set label
和set arrow
手动绘制图例。误差条可以绘制为具有两个头部的箭头,其形状为垂直于箭头线的线。这看起来像是:
# definition of arrow styles and line styles here, something like:
# set style line 41 lc rgb "#cccccc" lt 1 lw 1 ps 0.5 pt 6
# set style arrow 1 heads size screen 0.008,90 ls 1
# ...
set label "class 1" at graph 0.7, graph 1 # label
set arrow as 1 from graph 1, graph 0.97 to graph 1, graph 1.02 # arrow
set label "" at graph 1, graph 0.99 point ls 1 # dot
set label "class 2" at graph 0.7, graph 0.8 # label
set arrow as 2 from graph 1, graph 0.77 to graph 1, graph 0.82 # arrow
set label "" at graph 1, graph 0.79 point ls 2 # dot
你当然可以调整条的长度,它们的位置,点大小,垂直线长度......