[IPython-User] qtconsole ignoring subplot spacing widths

Fernando Perez fperez.net@gmail....
Mon Jan 30 00:54:36 CST 2012


On Sun, Jan 29, 2012 at 7:55 PM, Joon Ro <joonpyro@gmail.com> wrote:
> I actually have been struggling with this for several days.
> Whatever I do, when I have subplots I cannot make it show suptitle.
>
> I just tried the following in my notebook,
>
>> plt.plot([1,2,3])
>> plt.suptitle('foo')
>> plt.subplots_adjust(top=.5)
>
> and there is no suptitle.
> When I run an example in matplotlib:
> http://matplotlib.sourceforge.net/pyplots/text_commands.py
>
> Also the suptitle is not showing.

It's actually a matplotlib bug, we discussed it today on the mpl-dev list:

https://github.com/matplotlib/matplotlib/issues/688

Jae-Joon jumped on it and now there's a PR for it, I've just reviewed
it and confirmed that it fixes the problem:

https://github.com/matplotlib/matplotlib/pull/689

In the meantime, you can work around the issue by editing in IPython
the file IPython/core/pylabtools.py, and changing line 105 from

        fig.canvas.print_figure(bytes_io, format=fmt, bbox_inches='tight')

to:

        fig.canvas.print_figure(bytes_io, format=fmt)

This may cause too much whitespace in other circumstances, which is
why we use it, but it will work around the matplotlib issue.

Hopefully we'll merge this soon in MPL and you can then update that,
which is the proper fix.

Best,

f


More information about the IPython-User mailing list