I was wondering why matplotlib strives to support so many
> backends...
Accretion. In the beginning there was GTK, but being a LaTeX user, I
needed a postscript output. Also, there was a lot of interest in a
pure image backend that could make JPG/PNG/etc w/o having a window
popup. gdmodule is a python module wrapping the very nice gd library
so I wrote the gd backend to provide pure image generation (could have
just as easily done PIL at this point). Around the same time, David
Moore, also needing a pure image backend (gd hadn't been ported to
win32 yet), stealthily developed paint, a libart backend. Meanwhile,
Jeremy needed wx at work, and developed the wx backend.
At this time the proliferation of backends was beginning to become a
maintenance hassle, and Perry Greenfield had a bright idea: another
backend! But not just any old backend, the mother of all backends,
that could be used not only for pure image generation but used to
render directly into the GUI canvases. GTK and WX use native GUI
drawing code to render the figure, so we not only need to support not
only all the widget-set related stuff, but all the drawing stuff as
well.
The new idea is to focus development on one high quality image backend
and use this in as many areas as possible. We looked hard at libart
and gd, but both had bugs that could not be fixed. Having worked with
the developers of chaco, Perry suggested antigrain which is a very
high quality 2D image library that I've just begun to scratch the
surface of. So Agg was born and the GUI wrappers GTKAgg, TkAgg and
WXAgg quickly followed suit. These 3 are the GUI backends of choice
for performance, feature set, and quality.
I still support the other backends because people still use them but
spend less energy porting all the new features to them. If someone
says "I need alpha blending on WX", I usually say "Can you use
WXAgg?", and so on. postscript is still very actively maintained
because it is in a different category and widely used for publication
and TeX.
> I wrote a gui app in matlab that takes the fourier
> transform of a semi-infinite crystal. The point is to
> simulate X-ray diffraction (I work at the Cornell
> Synchrotron). The program is pretty good, from a science
> standpoint. I am considering publishing the work, but I
> wanted to make it open source. What's the point of doing
> work funded by the NSF if the public can't access it? So I
> am investigating rewriting the code using pygtk. I wanted
> something free and cross platform, and I need the
> vectorized matrix operations.
> Aside from that specific project, I am just trying to get
> the interactive feel of matlab. I need to take some time
> to look carefully through all the documentation here, it
> seems all of my questions have had answers published on
> the web.
Sounds very similar to my situation. I develop a pretty complex
application for EEG and medical image data analysis. I originally
wrote it in matlab but became dissatisfied with the ability of matlab
to easily manipulate complex data structures, work with databases,
fill out CGI forms, and the like. You can do all of this in matlab
using the matlab JVM stuff (and I did), but it's a pain and it's slow.
I started over in python and decided on pygtk. I couldn't find a 2D
plotting library I was satisfied with so wrote matplotlib around
pygtk. If you need any additional encouragement, the quality of the
application and the ease of extending it are dramatically better now.
I develop on linux and most of the users are on win32, and have been
very happy with GTK on win32. The only bug I've seen on OS X is that
progress bars don't seem to work. Now I see why you were looking at
interactive2.py -- you want to embed a python shell in your
application. I think pygtk + matplotlib + GTKAgg
+ a modified interactive2.py is a good combination for you. Some
features of interactive2.py are underdeveloped, such as cutting and
pasting code blocks from an editor into the interpreter.
You may also want to look into VTK if you need 3D plotting, which has
nice integration with pygtk. I use this a lot in my application. I
find it amazing that you can embed an OpenGL window into a GTK widget
set wrapped by pygtk running in a python interpreter on a Microsoft
Windows OS and still get hardware acceleration!
JDH