The Voidspace Techie Blog

Golly, you're using Matplotlib without the pylab interface! Hardcore.

fig.savefig should do what you want. If you want a vector format, save as a .svg file.

The song and dance in that django example is probably to avoid ever saving the file to disk.


ZedGraph is what we use at work, its a C# library thats very nice, should work with IronPython, though I have never tried.


Gravatar I've looked at ZedGraph. It produces some very nice graphs - but not contour ones. :-(


Gravatar If you can settle for PNG, SVG or (E)PS output, then your script can be alot simpler:

import matplotlib
matplotlib.use("Agg")
import pylab
pylab.plot([1,2,3])
pylab.savefig("test.png")

Note, you can pass savefig an opef file object (e.g. stdout) in place of a filename.

Other backends (e.g. GD) may support JPEG output (but Agg (antigrain) has the best rendering quality but only does .PNG).


Gravatar Actually ZedGraph can do contour graphs, and for my purposes has a nicer API than matplotlib. It also has the added advantage that I can use it directly from .NET.


Gravatar numpy, numeric or numarray ? Any of the 3 will do. Numpy is prefered as it is most most recent and up to date. The others are no longer maintained. The next version of MPL will phase out numeric and numarray support.


Gravatar I know what the situation is - it doesn't make it much less confusing.

The docs don't make it clear that numpy is prefferred - and in fact under the hood matplotlib uses the old numarray interface even when you have numpy installed.


Name:

Email:

URL:

Comment:  ? 

 

Commenting by HaloScan