Generic Gnuplot
Some generic gnuplot stuff
Gnuplot:
Not so Frequently Asked Questions:
http://t16web.lanl.gov/Kawano/gnuplot/set-e.html
Gnuplot site: http://gnuplot.sourceforge.net/ (contains demos)
Generic gnuplot usage with gp file to plot points in x,y dimensions:
gnuplot makeplot.gp > plot.eps
makeplot.gp:
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 makeplot.gp | 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:
f(x)=sqrt(x)
or, more generic:
f(x)=x**(1/2)
WRONG! this gives a straight line, because gnuplot sees the “1” as an integer and rounds 1/2 to the nearest integer.
f(x)=x**(1.0/2)
Does exactly what you need here. Of course it also works for cube roots, n-th roots and arbitrary stuff like:
f(x)=1-(1-x)**(1.0/(n(x)-1))
with n(x) also defined as some function of x.