我想在gnuplot的直方图中添加一条水平线,这可能吗?
我的直方图在x轴上:alea1 alea 2 alea3 nalea1 nalea 2 nalea 3,y轴从0到25.
在22,我想添加一条横线,从直方图的一端到另一端.
vae*_*hen 12
尝试添加
, 22 title ""
Run Code Online (Sandbox Code Playgroud)
在你的情节命令结束时.适用于我的测试数据(文件"histo"):
# Year Red Green Blue
1990 33 45 18
1991 35 42 19
1992 34 44 14
1993 37 43 25
1994 47 15 30
1995 41 14 32
1996 42 20 35
1997 39 21 31
plot "histo" u 2 t "Red" w histograms, "" u 3 t "Green" w histograms, "" u 4 t "Blue" w histograms, 22 title ""
Run Code Online (Sandbox Code Playgroud)
(取自Philip K. Janert,Gnuplot in Action)
mgi*_*son 10
添加水平线和/或垂直线的典型方法是使用 arrow
set arrow from x1,y1 to x2,y2 nohead linestyle ...
Run Code Online (Sandbox Code Playgroud)
对于水平线,y1和y2将是相同的.从你的问题来看,我有点不确定你的意思是"在22",但我猜你的意思是你想要y=22
在直方图上绘制直线.如果是这种情况,请尝试此操作(在您的plot
命令之前).
set arrow from graph 0,first 22 to graph 1,first 22 nohead lc rgb "#000000" front
Run Code Online (Sandbox Code Playgroud)