[GRASS-dev] new MatPlotLib example

Michael Barton Michael.Barton at asu.edu
Fri Jul 25 19:24:15 EDT 2008


I revised the histogram_mpldemo.py script according to many of Glynn's  
suggests. I also added the option of creating the output file in png,  
pdf, ps, eps, and svg. As before, I've posted it at:

histogram_mpldemo.py

along with an example output:

testhist.pdf

I also posted another script that may be a better example of the  
potential of having this kind of library accessible for Python  
scripting in GRASS--whether we provide it or expect users to install  
it. This one does cross-plots of 2 maps as a density plot and a more  
normal scatter plot. The size of the points on the scatter plot are  
proportional to the number of cells with matching values in both maps-- 
sort of a bubble plot. In addition to file output, the plots  
optionally can be viewed in a simple Tkinter window. Tkinter comes  
with Python, so this doesn't require a separate TclTk installation. It  
can can also be displayed in a wxPython, QT, or GTK window, but I  
haven't worked out how to do that yet. The script is here:

crossplot_mpldemo.py

and the example density and scatter plots are here:

testdensity.png
testscatter.png

An ulterior motive here is to encourage people to begin to think about  
scripting in Python instead of just bash. Both of these scripts are  
very basic and could be improved. But they were easy to create. Also,  
the new grass.py library that Glynn recently created has a lot of nice  
convenience functions (only a couple used here) to make Python  
scripting for GRASS easier.

Enjoy
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
Tempe, AZ  85287-2402
USA

voice: 480-965-6262; fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

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


More information about the grass-dev mailing list