Generic Gnuplot

This entry was posted by on Friday, 26 August, 2011 at

Some generic gnuplot stuff

Not so Frequently Asked Questions:
Gnuplot site: (contains demos)

Generic gnuplot usage with gp file to plot points in x,y dimensions:
gnuplot > plot.eps

1 set terminal postscript eps enhanced
2 set key box
3 plot "out.txt" using 1:2 title 'data' with points

To make PDF plots:
gnuplot | epstopdf --filter > plot.pdf

Plotting n-th roots
When plotting a function, with an exponent, like f(x)=x^2, you need to replace the “^” with “**”: f(x)=x**2
Now say you want the square root, you have two options:
or, more generic:
WRONG! this gives a straight line, because gnuplot sees the “1” as an integer and rounds 1/2 to the nearest integer.
Does exactly what you need here. Of course it also works for cube roots, n-th roots and arbitrary stuff like:
with n(x) also defined as some function of x.

Leave a Reply