[Pythonmac-SIG] (novice query) plots, graphs, charts on Mac w/ python

John Hunter jdhunter at ace.bsd.uchicago.edu
Wed Oct 20 15:00:02 CEST 2004


>>>>> "Robert" == Robert Kern <rkern at ucsd.edu> writes:

    Robert> kevin parks wrote:
    >> Hi, What are the standard modules that work on mac for making
    >> charts and plotting data, etc. I need something that is easy to
    >> use, versitle, and WELL DOCUMENTED with examples, tutorials and
    >> documentation.  Anyone know a package that fits the bill? Is
    >> pil the way to go?  Sorry, i am kind of new to this type of
    >> computing and i know mac has it's own graphics issues..

    Robert> I recommend matplotlib.

    Robert> http://matplotlib.sourceforge.net/

    Robert> Raw PIL is almost certainly not the way to go.

I'll second that recommendation :-)

matplotlib supports many graphical user interfaces, unfortunately none
of them are native to OS X (this will change, I just don't know when).
SO you want to be a little careful when making the choice of which GUI
you will use.  For OS X, I recommend using either TkAgg which uses
Tkinter or GTKAgg which uses pygtk, because there are some problems in
the way the buttons are rendered on OS X with the wxpython backends.
There is also an FLTK backend, but as far as I know this has never
been tested on OS X.  Personally, I use GTKAgg on my powerbook, having
installed GTK and pygtk from src -- this approach is not for the faint
of heart.  I think the path of least resistance is TkAgg, especially
since you can get Tkinter from the python application manager
doohitchie.

Also, take a look at recent versions of ipython with --pylab option,
which is a nice platform for interactive work with matplotlib
plotting.

On the subject of a Cocoa/Aqua (pardon my naivete but what is the
difference?)  backend, this would be quite easy to implement using the
*Agg model of GTKAgg, WXAgg, TkAgg and FLTKAgg.  Basically, you just
need to grab a GUI window, plug an agg image into it, and wrap some
basic the event handling; the rest you get for free.  The Agg backend
provides both string and buffer access to it's image data, so you can
probably do it without any extension code.  I think a person who knew
the Cocoa GUI well could do it in a day, at most two.  If anyone
decides to take this on, please contact me because I have some advice
about things you can leave out (Eg, I don't see any reason to support
the classic toolbar, since the new one is so much better) that will
make this easier.  One could do a full blown backend with native
drawing, but there is not much incentive to since AquaAgg would be so
much easier, look just as good, and is much less of a burden to
maintain.

JDH



More information about the Pythonmac-SIG mailing list