3
votes

I would like to add a gray dashed vertical line on my graph with GNUPLOT.

My terminal is;

set terminal postscript portrait enhanced color dashed lw 1 "DejaVuSans" 12 size 6,6
set output "pic.ps"
set xrange [30:110]
plot 'smth.txt' w lines ls 7 t ""

I have looked into several ideas around but there seems to no explanation about how to get a dashed gray line vertically at let's say x = 40 (the line gonna be parallel to y-axis)

The image I have is like this;

1
Does this answer your question? How do I draw a vertical line in gnuplot? - norok2
this is the answer: stackoverflow.com/a/35613933/7295599 besides other confusing ones. - theozh

1 Answers

2
votes

The key is to use the set arrow command and remove the head to make it a line:

set arrow from 40,0 to 40,100 nohead lc rgb 'red' dt 2

Your graph does not specify any y value, so adjust it to a "larger than needed" value.

For dash type (dt), checkout p.42 of manual. It is terminal-dependent (I didn't tried with postscript), but you can adjust as needed.