Hi! I'd like to save figurecanvas as bitmap and don't need grey border around the plot in it. How can I hide this?
A:
I believe that savefig
will not include the gray border by default. However, .bmp
is not support by savefig
; use .png
instead.
import pylab
f = pylab.figure()
ax = f.add_axes([0.1, 0.1, 0.8, 0.8])
ax.plot([1,2,3],[4,5,6])
f.savefig('image.png')
Output:
Steve
2010-03-01 13:27:31
A:
Thanks, Steve. But the thing is that it is difficult at the current stage to change functionality. I get a figurecanvas as input for something like this:
buffer = figurecanvas.tostring_rgb()
bitmap = wx.BitmapFromBuffer(w_canvas, h_canvas, buffer)
So I need to make ready the figurecanvas so that it doesnt contain anything but a core plot.
Alex
2010-03-01 14:44:54
Hmm, I see. I am not as familiar with that, unfortunately.
Steve
2010-03-01 15:04:47
It was subplots_adjust, I should've searched better.
Alex
2010-03-01 15:13:37