You can draw a vertical line which spans the whole graph using set arrow
with graph
coordinates. Taking the sin_wave.rb example, here is an example:
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
require "gnuplot"
Gnuplot.open do |gp|
Gnuplot::Plot.new( gp ) do |plot|
plot.xrange "[-10:10]"
plot.title "Sin Wave Example"
plot.ylabel "sin(x)"
plot.xlabel "x"
x1 = 2
plot.arrow "from first %f,graph 0 rto first 0,graph 1 nohead lw 2 lt 0 lc 3" % x1
plot.data << Gnuplot::DataSet.new( "sin(x)" ) do |ds|
ds.with = "lines"
ds.linewidth = 4
end
end
sleep 10
end
with the result
For available coordinate systems other than first
and graph
, see e.g. https://stackoverflow.com/a/23180595/2604213