[SciPy-user] Why is SciPy better than Matlab or IDL? ;)
Wed Jul 8 14:35:36 CDT 2009
On 8-Jul-09, at 7:48 AM, Tim Michelsen wrote:
> Would be nice to see your implementation.
The way I did it was to do the plotting onto a FigureCanvasAgg and
then printing it to a fake file using cStringIO.
from matplotlib.backends.backend_agg import FigureCanvasAgg
import matplotlib.pyplot as plt
fig = plt.figure(...) # figure out size and such here
canvas = FigureCanvasAgg(fig)
fig.set_canvas(canvas) # I forget whether this is needed
# Do some plotting commands here
imgdata = cStringIO.StringIO()
There's something very similar in the Matplotlib cookbook or the
TurboGears cookbook, but I forget which.
More information about the SciPy-user