Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Plot a straight line, parallell to the y-axis in gnuplot?

  1. Nov 4, 2004 #1
    How do you plot a straight line, parallell to the y-axis in gnuplot?
    Something like:
    x = 20
  2. jcsd
  3. Nov 4, 2004 #2


    User Avatar
    Gold Member

    Last edited: Nov 4, 2004
  4. Nov 4, 2004 #3
    plot 20, gives y = 20, a line parallell with the x-axis.

    I want x = 20
  5. Nov 4, 2004 #4


    User Avatar
    Gold Member

    Try this:

    'set parametric'
    'plot 20,t'
  6. Nov 4, 2004 #5
    Hm, that gives me a short line, it stops at around y = 5. I need it all the way up since I'm plotting linear unequalities.
  7. Nov 4, 2004 #6


    User Avatar
    Gold Member

    'plot [t=-1000:1000] 20,t'

    Just change the t-range to whatever fits for you.
  8. Nov 4, 2004 #7
    Ah, perfect.

    Thanks a lot :)
  9. Nov 4, 2004 #8


    User Avatar
    Science Advisor
    Homework Helper

    Looks like you've gotten the other problem of the linear programming thing figured out. ;)
  10. Nov 5, 2004 #9
    hehe, yup :)
  11. Nov 7, 2004 #10
    can I get Gnuplot for windows?
  12. Nov 7, 2004 #11


    User Avatar
    Gold Member

    Yes, you can, but there's a catch. Gnuplot is primarily for Unix systems, however, an environment does exist for Win32 called Cygwin that will enable you to build Unix applications, such as Gnuplot.

    You can get Cygwin (be sure to read the documentation) from:


    Once you have Cygwin installed, grab the Unix sources from:


    Gnuplot's primary graphics environment is X11 - you'll have to install XFree86 in the Cygwin distribution. If you feel this is too complex for your tastes, Gnuplot can generate PDF and Postscript plots.

    Edit: I found this nice link on Gnuplot SF site:


    There are some Win32 packages, but you might have to have the Cygwin .dll or some more dependencies that are present in the Cygwin distribution. This will save you from building Gnuplot, regardless.
    Last edited by a moderator: Apr 21, 2017
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook