Search code examples
gnuplot

How to create a data file for gnuplot?


I'm trying to make a graph with gnuplot. I specified my xrange, yrange, and labels, but when I typed in the following command:

gnuplot> plot "data.txt" using 1:2 with lines

gnuplot tells me:

warning: Skipping unreadable file "data.txt" No data in plot.

I don't understand how my data file is unreadable. This is what my data.txt looks like:

X       Y  [I didn't enter X and Y into my text file]

10000   0.030
5000    0.02
1000    0.012

I know I must be doing something wrong -- this is my first time using gnuplot. I tried doing a Google search on how to make a proper data.txt file turns up zilch.


EDIT:

I feel like this may sound strange to ask at a programming Q&A site, but what should a typical text file w/data look like? I'm no computer programmer, just an undergrad trying to plot a graph for her biochemistry class.


Solution

  • plot "data.txt" using 1:2 with lines 
    

    works for me. Do you actually have blank lines in your data file? That will cause an empty plot. Can you see a plot without data? Like plot x*x. If not, then your terminal might not be set up correctly.