[GRASS-dev] matplotlib again

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>

+1 for d.histogram replacement

another +1 for svg output

2008/7/23 Michael Barton <michael.barton@asu.edu>:

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&gt;\.
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/&gt;\. 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>

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

--
Yann Chemin
International Rice Research Institute
Office: http://www.irri.org/gis
Perso: http://www.freewebs.com/ychemin