Hi. I stumbled over your matplotlib module, and it's
> exactly what I have been looking for being a long time
> matlab user.
> Since sourceforge is down, I have a question which I hope
> you'll answer, but I fully understand if you don't have
> the time
No problem, when it comes back up you may want to join the mailing
list
> (using GTK, latest version on winXP) creating a simple
> script like this:
> from matplotlib.matlab import * vector = [1, 2, 3, 4, 5,
> 3, 2, 1] plot(vec) savefig(r'c:\test.jpg')
> This does not save the file, but calling 'show()' will
> show the file and then save the file. Shouldn't it be
> possible to save a fig without calling show? I have plans
> to use this in a cgi application, and hope I can do it
> this way.
There are three ways to do this currently. Are you planning on
running your web server under windows or linux or other? The platform
you are on will determine which route is easiest.
1) On Linux/UNIX, Run matplotlib in a X virtual frame buffer (Xvfb)
which is a virtual X windows. There you can save the figures in
the GTK backend with no window ever popping up. I'm going to do
some more investigating to see if pygtk is capable of drawing
with no window in the absence of Xvfb (in which the window is
simulated). I am using matplotlib in a web application server so
I can provide some example code.
2) Alternatively, you can use the GD backend, which is designed to
do offline drawing. I haven't succeeded in getting gdmodule
compiled for windows, but I know it's doable. I just haven't
pressed the issue because so far noone has wanted it.
3) Finally, a hack solution which would work under windows is to use
the ps backend to generate the plots (this requires only Numeric
and produces high quality output) and use another module like PIL
to convert them to PNG or JPG to serve over the web. This is in
my opinion the least desirable solution, but one you may want to
consider if you must work on win32 and can't get GD running.
> If I were better at programming, I would have written a
> PIL module for matplotlib, since matplotlib is a module I
> will use extensively in the future
I would like to have a PIL and python Tk backend. So when you get
you're programming chops up to speed, definitely think of us!
John Hunter