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

Mak*_*asu 4 text position gnuplot legend labels

我的情节的本质是绝对标签不起作用; 我不能限制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 = 10\n 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'
Run Code Online (Sandbox Code Playgroud)

PS:还有,有没有更好的方法让我的垂直线在x = -2和x = 2?箭头解决方案再次不理想,因为我的y范围通常大于或小于2000.

Chr*_*oph 7

在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
Run Code Online (Sandbox Code Playgroud)

size如果没有箭头,则无需设置.

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

set label "V_0 = 10\n E = 1" right at graph 0.9, graph 0.8
Run Code Online (Sandbox Code Playgroud)