[GRASS-dev] Re: numeric-numpy-scipy for graphs?

Glynn Clements glynn at gclements.plus.com
Mon Apr 23 05:08:54 EDT 2007

Paul Kelly wrote:

> > Following up on this and the many other interesting posts to this thread...
> >
> > I asked if anyone objected to having numpy or scipy (incluing numpy) as a
> > dependency for the new wxPython GUI. The response has been overwhelmingly in
> > favor, pointing out the many things possible with this kind of package.
> >
> > I just want to use it to make nicer plotting easier (e.g., for profiling and
> > histogramming) in the GUI, but obviously it has other uses. And of course,
> > there are a number of other even more sophisticated plotting/graphing
> > packages that also run under wxPython and scipy.
> TBH I was being lazy and waiting for more information on what specifically 
> it could be used for before giving an opinion... the names at least 
> suggest they are primarily for numerical calculations etc. and not drawing 
> graphics? I wonder do the parts of Pyplot you want to use even use anything
> in NumPy?

Looking at the source code, it's all basic stuff: primitive array
operations plus fabs, floor, ceil, log10, power, sqrt, minimum,

The comment at the top of plot.py says:

    This is a simple light weight plotting module that can be used with
    Boa or easily integrated into your own wxPython application.  The
    emphasis is on small size and fast plotting for large data sets.  It
    has a reasonable number of features to do line and scatter graphs
    easily as well as simple bar graphs.

Excluding the demo (which is built into the package), it's ~1500
(non-blank) lines of code.

AFAICT, an equivalent d.* module would be a decent day's work
(assuming that you knew what you wanted at the outset). The only real
advantage of PyPlot would be the ability to zoom/pan in real time.

[BTW, on the subject of perfomance: I've extended the PNG driver to
support writing 32-bpp BMP files. More significantly, if you set
GRASS_PNG_MAPPED=TRUE, it will immediately write out the file, then
mmap() for use as its framebuffer, so it doesn't have to explicitly
write the file after each command.]

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list