Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3338256
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:21:14+00:00 2026-05-18T00:21:14+00:00

I would like to plot a series of vertical lines in gnuplot at a

  • 0

I would like to plot a series of vertical lines in gnuplot at a set interval.

Some information about the plot.

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).

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

with the . plt file looking like this.

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
#

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 http://t16web.lanl.gov/Kawano/gnuplot/parametric-e.html

set parametric
const=3
set trange [1:4]
set xrange [0:5]
set yrange [0:5]
plot const,t

I would like to have

const=repititionperiod*i

where i is an integer belonging to (1,calculateduppedlimit].

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.

I can’t find any information on loops within gnu plot or adding to a previously created plot.

Any advice gratefully received.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T00:21:15+00:00Added an answer on May 18, 2026 at 12:21 am

    EDIT: Gnuplot does now in fact now support a for loop, you can read about it here

    As I understand gnuplot doesn’t have a for loop, although you can generate one of sorts as follows:

    Make a file “loop.gp” containing

    const  = const + 1
    #... some gnuplot commands ... 
    if(const<100) reread
    

    then in a gnuplot terminal, or script write,

    const = 3; load "loop.gp";
    

    This will give you a simple loop.

    (this example is taken from the misc. section of http://t16web.lanl.gov/Kawano/gnuplot/index-e.html)

    For your particular answer you might try adding arrows rather than paremetric lines,
    eg.

    set arrow from const,1 to const,4 nohead
    

    will do much the same thing.

    In this case you loop.gp could be

    const  = const + repititionperiod
    #... some gnuplot commands ...  
    set arrow from const,1 to const,4 nohead
    if(const<calculatedupperlimit) reread
    

    and you would run you loop with

    const = 1; repititionperiod=2;calculatedupperlimit = 10; load "loop.gp"; replot;
    

    The replot plots the arrows.

    If you “just” want the lines and nothing else – then you will need to feed a graph to actually plot (a set of arrows doesn’t count). The example you gave could then be used to plot the first vertical line.

    hope this helps.

    Tom

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large real 1-d data set called r. I would like plot:
I am using the MSChart Control to plot some data but I would like
I have point series in a data.frame with duplication. I would like to plot
I would like to plot a heatmap on a table imported from MATLAB. The
I would like to plot a vertical line (I'd prefer any orientation, but I'd
I would like to plot results from a MDS analysis with 3 dimensions using
I would like to make a log-probability plot for my data. I looked up
I would like to plot a simple graphic. I have a dat set with
I would like to plot this kind of data: X axis: dates Y axis:
Suppose one would like to plot 2 sets of data with unequal number of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.