tags:

views:

155

answers:

3

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:

Simple Plot.

Steve
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
Hmm, I see. I am not as familiar with that, unfortunately.
Steve
It was subplots_adjust, I should've searched better.
Alex
A: 

I found it: subplots_adjust.

Alex
Can anyone explain how Matplotlib sizes / packs things in general ?Take for example 3 vertical subplots with titles and xlabels:how much space do title1 plot1.h xlabel1 hspace title2 ... get ?
Denis