Use gnuplot in python

Usually I use gnuplot to plot some data.
If you calculate things in c++ you have to see the output using gnuplot quite often, so there should be some automation
to generate the plots. python is perfect for it.

Let's assume you have "programm.dat" with your data.

# Import the gnuplot packages
import Gnuplot, Gnuplot.funcutils

plot = Gnuplot.Gnuplot()
plot('set terminal eps')
plot("set output 'programm.eps'")
plot("plot 'programm.dat' title 'Data'")
plot('quit')

That's it.

Add new comment