Hi, Is there a way to get the output of a plot (the
> bitmap) and assign it to a bitmap object such as wxBitmap
> or wxImage? I know how to do this by saving the figure
> and loading it to wxBitmap. But there must be a way to do
> 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.