我想在gnuplot的直方图中添加一条水平线,这是否可行?
我的直方图在x轴上有:alea1 alea2 alea3 nalea1 nalea2 nalea3,y轴从0到25。
在22处,我想添加一条水平线,从直方图的一端横跨到另一端。
尝试添加
, 22 title ""
# 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 ""
典型的添加水平和/或垂直线的方式是使用箭头arrow
set arrow from x1,y1 to x2,y2 nohead linestyle ...
对于一条水平线,y1和y2将是相同的。从你的问题中,我有点不确定你在“22”处的意思,但我猜想你想在直方图上绘制线条 y=22
。如果是这样,可以在你的plot
命令之前尝试这个。
set arrow from graph 0,first 22 to graph 1,first 22 nohead lc rgb "#000000" front
set label "some text" at ...,...
即可。但是,您也可以使用其他答案执行以下操作:plot <histogram_stuff>, 22 w lines title "some text"
,以将其实际放置在绘图键中。 - mgilson
notitle
is somewhat cleaner thantitle ""
- hertzsprung