是否可以在gnuplot中设置标签相对于键的位置



我的绘图的本质是,绝对标签实际上不起作用;我不能限制y的范围,所以想知道是否有办法将我的标签文本包含在密钥中,或者将其相对于密钥放置(即在下方)

set term png enhanced size 1024,768
set title "{/=15 1D My title}n - by me"
set xlabel "x"
set ylabel "y"
set label "V_0 = 10n E = 1" #this is the bit I want to reposition
set out 'trial.png'
set xrange [-2.5:2.5]
set arrow from -2,-2000 to -2,2000 nohead size screen 0.025,30,45 ls 1
set arrow from 2,-2000 to 2,2000 nohead size screen 0.025,30,45 ls 1
plot 'data.dat'

PS:还有,有没有更好的方法来获得x=-2和x=2的垂直线?箭头解决方案同样不理想,因为我的y范围通常大于或小于2000。

在gnuplot中,您可以使用不同的坐标系来设置箭头、标签、键和对象。坐标可以指定为

  • first:左侧和底部轴上的值
  • second:右侧和顶部轴上的值
  • graph:相对于轴内的区域,0,0位于左下方,1,1位于右上方
  • screen:相对于整个画布
  • character:取决于所选的字体大小

有了这个,你可以用以下方式设置你的箭头:

set arrow from first -2,graph 0 to first -2,graph 1 nohead ls 1
set arrow from first 2,graph 0 to first 2,graph 1 nohead ls 1

如果没有箭头,则不需要设置size

虽然我没有完全理解你的标签问题,但我相信你会用这些关于不同坐标类型的信息来解决它:

set label "V_0 = 10n E = 1" right at graph 0.9, graph 0.8

最新更新