wx.Printout: how to print a matplotlib figure

Message

Get the figure as a bitmap and use dc.DrawBitmap.

With matplotlib I can get it, as far as I know, not as a bmp. Is there a possibility to convert it to bitmap (from eps or png) during runtime? I tried it with PIL, without success :frowning:

Thanks for any advice…

Frederik Golks

···

fgolks@freenet.de wrote:

Get the figure as a bitmap and use dc.DrawBitmap.

With matplotlib I can get it, as far as I know, not as a bmp. Is there a possibility to convert it to bitmap (from eps or png) during runtime? I tried it with PIL, without success :frowning:

Yes, you could have MPL save a PNG, and then construct a wx.Bitmap from that file, but I don't think that's what you want to do. The MPL wx and wxAgg back ends already convert to wxBitmap -- you should be able to use those, or at east borrow code from them. Id start with the wxMpl wrapper or the embedded in wx examples, and go from there.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception