title: Gnuplot script, for loop within or adding to existing plot
body: <p>I would like to plot a series of vertical lines in gnuplot at a set interval.</p>
  
  <p>Some information about the plot.</p>
  
  <p>The plot is mainly some data from a .dat file. The gnuplot script is called by a bash scripts which alters the gnu plot script using sed. This is a snipit of the an old bash script (ugly I'm sure).</p>
  
  <pre><code>sed -i 's/C = CONCEHOLD/C = '${$CO}'/g' $GNUPLOTROOT/plotviscosity.plt
  gnuplot $GNUPLOTROOT/plotviscosity.plt
  mv my-plot.ps $VISCPLOTNAME
  sed -i 's/C = '${$CO}'/C = CONCEHOLD/g' $GNUPLOTROOT/plotviscosity.plt
  </code></pre>
  
  <p>with the . plt file looking like this.</p>
  
  <pre><code>set title "Viscosity vs Time, C = CONCEHOLD, beta = RATHOLD, zeta = ZETAHOLD"
  set xlabel "Time"
  set ylabel "Viscosity"
  plot "viscout.dat" using 3:2 title 'Viscosity'
  # Saving to my-plot.ps
  load save.plt
  #
  </code></pre>
  
  <p>I would like to add to this plot a series of vertical lines at a set repeating interval. I have found how to plot vertical lines via <a href="http://web.archive.org/web/20110716113337/http://t16web.lanl.gov/Kawano/gnuplot/parametric-e.html" rel="nofollow">http://t16web.lanl.gov/Kawano/gnuplot/parametric-e.html</a></p>
  
  <pre><code>set parametric
  const=3
  set trange [1:4]
  set xrange [0:5]
  set yrange [0:5]
  plot const,t
  </code></pre>
  
  <p>I would like to have </p>
  
  <pre><code>const=repititionperiod*i
  </code></pre>
  
  <p>where i is an integer belonging to (1,calculateduppedlimit].</p>
  
  <p>I could input repititionperiod via sed again and in a similar vain calculateduppedlimit but need some sort of for loop either within gnuplot or a separate gnuplot script that adds a vertical line to the already created plot within a for loop in my bash script.</p>
  
  <p>I can't find any information on loops within gnu plot or adding to a previously created plot.</p>
  
  <p>Any advice gratefully received.</p>