Created at:

Gnuplot notes


If you have a file with the following content::

    1.00  3.00
    2.00  5.20
    3.00  4.95

Where the first column are X values and the second are Y values to be plotted, use the following command to plot them::

    $ gnuplot -e 'plot "file.txt" using 1:2 with lines' -e 'pause -1'

The -e flag accepts commands to be passed to the Gnuplot language. So, we are executing two commands, plot that shows the window with the graph and pause, that waits so the user can see the it.

You can customize your plot with other flags. For instance, setting a range to the Y axis::

    $ gnuplot -e 'set yrange [20:100]' -e 'plot "file.txt" using 1:2 with lines' -e 'pause -1'