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

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

问题描述

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}
 - by me"
set xlabel "x"
set ylabel "y"
set label "V_0 = 10
 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: 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.

解决方案

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

  • 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

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
 E = 1" right at graph 0.9, graph 0.8

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

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