[GRASS-dev] matplotlib again

Michael Barton michael.barton at asu.edu
Tue Jul 22 21:07:26 EDT 2008


While waiting for an answer from the developer of one of the wxPython  
mixins on why it doesn't work, I spent a little time looking at  
MatPlotLib again.

Sometime back, I'd mentioned this as a potentially useful library to  
include with a Python-enabled GRASS because it can create a rich array  
of high-quality graphs and charts (and even maps). One of the issues  
raised was that it needs to be used within a GUI environment meaning  
that the GUI can do things that the command line can't. Not long ago,  
while talking with a Python-using colleague, I mentioned MatPlotLib  
and he said, 'of course it can be used from the command line to create  
a graphic file; I do it all the time'. So I looked into to it today  
while recovering from a wisdom tooth extraction. Indeed, it can be put  
into a script to be run from the command line and output a normal  
graphic file, like a *.png. Here is a link on how to do it.

<http://www.dalkescientific.com/writings/diary/archive/2005/04/23/matplotlib_without_gui.html 
 >.

This cookbook entry is 3 years old. Along with the Agg backend  
mentioned in the cookbook (for png), new backends for MatPlotLib  
include Cairo (for pdf, png, ps, svg, and svgz), dedicated pdf and ps,  
and dedicated svg--in addition to GUI backends for wx, TclTk, and Qt.

We could use it to replace dedicated GRASS code for creating graphs  
like d.histogram and build it into scripts that now call gnuplot. It's  
worth checking out at <http://matplotlib.sourceforge.net/>. It could  
be used within the GUI of course, but also within scripts to output to  
graphic files.

Michael
____________________
C. Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20080722/6eb9758b/attachment.html


More information about the grass-dev mailing list