1

I'd like to save figurecanvas as bitmap and don't need grey border around the plot in it. How can I hide this?

2
  • @Alex, can you include some sample code that demonstrates your problem? I'm trying to code up a sample with the wxAgg backend but can not get the call to figurecanvas.tostring_rgb() to work. Commented Mar 1, 2010 at 15:12
  • @Mark, if you showed me your code I could try to find the ploblem. Did you call draw() before? Commented Mar 1, 2010 at 15:46

2 Answers 2

2

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.
(source: stevetjoa.com)

Sign up to request clarification or add additional context in comments.

Comments

0

I found it: subplots_adjust.

1 Comment

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 ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.