Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set title for arrow in gnuplot

Tags:

gnuplot

I've used the arrow to draw a vertical line and I would like to title it so it's shown in the key. Is there a way to do it? As far as I can tell for the manual, there's no title option in the syntaxis for arrow, but I'm sure there's a workaround.

The only thing I think of is drawing the arrow with the same color as something outside the plot range and use its title, but it's rather clumsy.

I'm using the terminal pngcairo, just in case it's relevant.

like image 751
Javier Avatar asked Oct 29 '25 11:10

Javier


1 Answers

Gnuplot will ignore anything with an invalid value (1/0 for instance). You can take advantage of this to plot what you want.

Suppose that we set a vertical line with

set arrow from 1,graph 0 to 1,graph 1 nohead lt 0

Now, if I want this to be in the key, I can just plot a line with lt 0 but specify the y-value as 1/0. This will insert it in the key, but will not actually draw the line.

plot [-3:3] x**2 t "X Squared", 1/0 t "Vertical Line" lt 0

enter image description here

like image 128
Matthew Avatar answered Oct 31 '25 11:10

Matthew



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!