How to create a data file for gnuplot

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.

Best Answer

Either as most people answered: the file doesn't exist / you're not specifying the path correctly.

Or, you're simply writing the syntax wrong (which you can't know unless you know what it should be like, right?, especially when in the "help" itself, it's wrong).

For gnuplot 4.6.0 on windows 7, terminal type set to windows

Make sure you specify the file's whole path to avoid looking for it where it's not (default seems to be "documents")

Make sure you use this syntax:

plot 'path\path\desireddatafile.txt'

NOT

plot "< path\path\desireddatafile.txt>"

NOR

plot "path\path\desireddatafile.txt"

also make sure your file is in the right format, like for .txt file format ANSI, not Unicode and such.

Related Topic