Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I draw a set of vertical lines in gnuplot?

Tags:

gnuplot

E.g. if I have a graph and want to add vertical lines at every 10 units along the X-axis.

like image 661
agam Avatar asked Dec 16 '10 02:12

agam


People also ask

Which command is used to plot vertical line in gnuplot?

to draw a vertical line The range of t is controlled by the command set trange . In this case the vertical line is draw at x=3.

How do I add a vertical line in GG plot?

To create a vertical line using ggplot2, we can use geom_vline function of ggplot2 package and if we want to have a wide vertical line with different color then lwd and colour argument will be used. The lwd argument will increase the width of the line and obviously colour argument will change the color.

What is gnuplot command?

Gnuplot is a free, command-driven, interactive, function and data plotting program. Pre-compiled executeables and source code for Gnuplot 4.2. 4 may be downloaded for OS X, Windows, OS2, DOS, and Linux. The enhancements provided by version 4.2 are described here. On Windows, unzip gp424win32.


3 Answers

Here is a snippet from my perl script to do this:

print OUTPUT "set arrow from $x1,$y1 to $x1,$y2 nohead lc rgb \'red\'\n";

As you might guess from above, it's actually drawn as a "headless" arrow.

like image 76
Throwback1986 Avatar answered Oct 02 '22 19:10

Throwback1986


From the Gnuplot documentation. To draw a vertical line from the bottom to the top of the graph at x=3, use:

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

like image 50
Nicholas Avatar answered Oct 02 '22 19:10

Nicholas


alternatively you can also do this:

p '< echo "x y"' w impulse

x and y are the coordinates of the point to which you draw a vertical bar

like image 15
Peter Nemeth .malomsok. Avatar answered Oct 02 '22 20:10

Peter Nemeth .malomsok.