creating graphs from lists

L

Luis P. Mendes

I'm developing a program in Python, with no gui, and now I've reached a
point where I would need to plot list of elements on a graph.

How can I do it? preferably in a simple way?


Luis
 
M

mutah

Luis said:
I'm developing a program in Python, with no gui, and now I've reached a
point where I would need to plot list of elements on a graph.

How can I do it? preferably in a simple way?


Luis

Depending on how sexy must look your graph, have a look on gnuplot and
his pythonixc interface gnuplot-py, http://gnuplot-py.sourceforge.net/,
it may fits your requirements

Mutah
 
J

John Hunter

Luis> I'm developing a program in Python, with no gui, and now
Luis> I've reached a point where I would need to plot list of
Luis> elements on a graph.

Luis> How can I do it? preferably in a simple way?


matplotlib has non GUI-outputs. You select these by choosing your
"backend". There are two ways of doing this, from the prompt or in a
configuration file. Let's say you have a script to plot a list

from matplotlib.matlab import *
plot([1,2,3])
savefig('somefile')

If you run this script as
> python myscript.py -pPS # generate postscript somefile.ps
> python myscript.py -pSVG # generate SVG somefile.svg
> python myscript.py -pAGG # generate somefile.png

If you know you always want to generate png for example, you can set
this by default and don't have to supply the command line option.

matplotlib also has a GUI mode, but you don't need it.

homepage : http://matplotlib.sourceforge.net
screenshots : http://matplotlib.sourceforge.net/screenshots.html
tutorial : http://matplotlib.sourceforge.net/tutorial.html

John Hunter
 
L

Luis P. Mendes

Thank you for the replies.

John,

matplotlib is what I need, specially with the pcolor_demo.py module.

Thank you again.

Luis Mendes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,525
Members
44,997
Latest member
mileyka

Latest Threads

Top