Is it possible to set the position of the label relative to the key in gnuplot?

The nature of my conspiracy is such that absolute labels really don't work; I cannot limit the range to y, so I wondered if there is a way to include my label text inside the key or put it 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: is there also a better way to get my vertical lines at x = -2 and x = 2? The arrow solution is again not perfect, as my y range is often greater or less than 2000.

+4
source share
1 answer

In gnuplot, you can use different coordinate systems to set arrows, labels, keys, and objects. Coordinates can be specified as

  • first : the value on the left and bottom.
  • second : value for the right and top axes.
  • graph : relative to the area inside the axes, 0,0 is in the lower left and 1,1 in the upper right corner.
  • screen : relative to the entire canvas.
  • character : depends on the font size selected.

With this, you can set the arrows as follows:

 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 do not need to set size unless you have an arrow.

Although I did not fully understand your question with the label, I am sure that you will solve it using this information about different types of coordinates:

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

Source: https://habr.com/ru/post/1492281/


All Articles