|
From: John H. <jdh...@ac...> - 2004-04-29 15:36:32
|
>>>>> "Flavio" == Flavio Codeco Coelho <fcc...@fi...> writes:
Flavio> Hi, Is there a way to get the output of a plot (the
Flavio> bitmap) and assign it to a bitmap object such as wxBitmap
Flavio> or wxImage? I know how to do this by saving the figure
Flavio> and loading it to wxBitmap. But there must be a way to do
Flavio> it directly. Does anyone know how to do this?
Using the OO FigureCanvasWxAgg API, which I think you are using, you
already have the canvas instance. The call to canvas.draw() sets the
bitmap instance, which you can access as canvas.bitmap. So after any
draw command canvas.bitmap is updated.
You can take a look at
matplotlib.backends.backend_wxagg.FigureCanvasWxAgg.draw to see how
the backend is using agg to render, create a wxImage and wxBitmap.
You can either use the result of these calls (canvas.bitmap) or just
make them yourself in another part of your code.
JDH
|