util:gnuplot
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | util:gnuplot [2013/11/08 22:43] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== GnuPlot ====== | ||
+ | |||
+ | GnuPlot is the ultimate plotting tool and very powerful which has the downside | ||
+ | of being quite hard to use especially for new users. Hopefully this article | ||
+ | clears things up a bit (for me at least). | ||
+ | |||
+ | ===== Plotting ===== | ||
+ | |||
+ | Probably the most common task performed when using a plotting tool is ... | ||
+ | plotting! Here are a few examples: | ||
+ | |||
+ | Plotting a function: | ||
+ | gnuplot> plot f(x) = x**2, f(x) | ||
+ | |||
+ | The same as above, but giving the range to plot: | ||
+ | gnuplot> plot [-5:5] f(x) = x**2, f(x) | ||
+ | |||
+ | Plotting two functions in the same plot: | ||
+ | gnuplot> plot f(x) = x**2, g(x) = x**3, f(x), g(x) | ||
+ | |||
+ | ==== Data Files ==== | ||
+ | |||
+ | First, generate some data: | ||
+ | $ ping nwl.cc | sed -un ' | ||
+ | |||
+ | The output looks like this: | ||
+ | <file / | ||
+ | 20.8 | ||
+ | 20.7 | ||
+ | 23.2 | ||
+ | 20.2 | ||
+ | 21.0 | ||
+ | 19.3 | ||
+ | 21.2 | ||
+ | 20.9 | ||
+ | 22.6 | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Now plot it: | ||
+ | gnuplot> plot '/ | ||
+ | |||
+ | ===== Output To File ===== | ||
+ | |||
+ | File output is configured by setting a different terminal than the default | ||
+ | '' | ||
+ | the filename: | ||
+ | |||
+ | gnuplot> set terminal png size 800,600 | ||
+ | gnuplot> set output '/ | ||
+ | |||
+ | Afterwards the output of any '' | ||
+ | /// | ||
+ | |||
+ | Creating PDFs works equvalently, | ||
+ | differently (inches instead of pixels): | ||
+ | |||
+ | gnuplot> set terminal pdf size 8,6 | ||
+ | gnuplot> set output '/ | ||
+ | |||
+ | But it gets even better, latex output: | ||
+ | |||
+ | gnuplot> set terminal latex size 8,6 | ||
+ | gnuplot> set output '/ | ||
+ | |||
+ | There are various output formats available, one may even chose between | ||
+ | different latex packages to use. For reference, see the output of '' | ||
+ | terminal'' | ||
util/gnuplot.txt · Last modified: 2013/11/08 22:43 by 127.0.0.1