1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Help with Plotting/Saving in Gnuplot

  1. Sep 11, 2011 #1
    1. The problem statement, all variables and given/known data

    Download the file xxx.dat. Create a gnuplot "macro" lab03.gpl which, when loaded by gnuplot will do the following:

    - create an output postscript file lab03.ps
    - make a plot of the contents of xxx.dat, for x-axis (column 1) values between -0.5 and 3.5 and y-axis (column 2) values between -0.1 and 1.1, in the postscript file.
    - reset the gnuplot terminal type to X11.

    2. Relevant equations


    3. The attempt at a solution

    Here is what I am doing.

    I create a .dat with with the above download (which is just two columns of values).

    Then I create a .gpl file with the following line: plot [-0.5:3.5] [-0.1:1.1] 'xxx.dat' with lines

    After opening gnuplot I type: load "xxx.gpl" and my plot opens fine.

    Reading some instructions on saving plots, I then do:

    set terminal to postscript
    set output "xxx.ps"

    Then quit gnuplot.

    Lastly I use gv to view my newly created .ps file using: gv xxx.ps. After a few seconds I get an error saying gv cannot open file because there is no data.

    Sure enough using ls -l I can my xxx.ps file is 0kb.

    Any ideas what I am doing wrong or why this isn't working?
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted