是否可以设置标签相对于gnuplot中的键的位置? [英] is it possible to set the position of a label relative to the key in gnuplot?

查看:379
本文介绍了是否可以设置标签相对于gnuplot中的键的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

The nature of my plot is such that absolute labels don't really work; I can't restrict the range in y, so wondered if there was a way to either include my label text inside the key or have it placed relative to the key (i.e. below)

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'

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

PS: also, is there a better way to get my vertical lines at x = -2 and x = 2? The arrows solution is again not ideal since my y range is often greater or smaller than 2000.

推荐答案

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

In gnuplot you can use different coordinate systems to set arrows, labels, key and objects. The coordinates may be specified as

  • first:左右轴上的值.
  • second:左右轴上的值.
  • graph:相对于轴内区域,0,0在左下方,1,1在右上方.
  • screen:相对于整个画布.
  • character:取决于所选的字体大小.
  • first: value on the left and bottom axes.
  • second: value on the right and top axes.
  • graph: relative to the area within the axes, 0,0 is bottom left and 1,1 is top right.
  • screen: relative to the entire canvas.
  • character: depends on the chosen font size.

以此,您可以通过以下方式设置箭头:

With this, you can set your arrows in the following way:

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.

You don't need to set a size if you don't have an arrow head.

尽管我还不太了解您的标签问题,但是我敢肯定,您将通过以下有关不同坐标类型的信息来解决该问题:

Although I did not fully understand your label question, I'm sure you will solve it with these information about different coordinate types:

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

这篇关于是否可以设置标签相对于gnuplot中的键的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆