How would you make a matplotlib chart span across entire panel?

Hi,

I have placed a matplotlib on a wxpython panel, but the grey spaces around chart area won’t diminish, no matter what I try.

I tried using

self.fig.subplots_adjust(left=0.00001,right=0.0001,bottom=0.00001,top=0.0001)

and

self.fig.tight_layout(pad=0.00001)

but neither of them worked. Could you offer an opinion please? Thanks.

As far as I can tell, this is a matplotlib issue, not a wxPython one. You
should direct matplotlib questions to their mailing list (or elsewhere).

That said, one thing I notice is that you seem to be using subplots_adjust
incorrectly. Have you tried something more like?:

    self.fig.subplots_adjust(left=0.1,right=0.90,bottom=0.1,top=0.9)

Che

···

On Fri, May 16, 2014 at 4:05 PM, steve <oslocourse@gmail.com> wrote:

Hi,

I have placed a matplotlib on a wxpython panel, but the grey spaces around
chart area won't diminish, no matter what I try.

I tried using

self.fig.subplots_adjust(left=0.00001,right=0.0001,bottom=0.00001,top=0.0001)

and

self.fig.tight_layout(pad=0.00001)

but neither of them worked. Could you offer an opinion please? Thanks.

Difficult to say without more information about your code attached.

In my experience Figure.tight_layout() works well with mpl/wx (tested on Windows/Matplotlib 1.3.1/wxPython 2.9.5 ).

Find an example attached which shows that tight_layout() indeed does its job. Put fig.tight_layout() in a EVT_SIZE handler for the frame if you want to “re-tighten” the layout when resizing.

With best regards

tight_layout.py (1.34 KB)

···

On Friday, May 16, 2014 10:05:15 PM UTC+2, steve wrote:

self.fig.tight_layout(pad=0.00001)

but neither of them worked. Could you offer an opinion please?