|
From: Paul H. <pmh...@gm...> - 2013-01-14 17:39:22
|
On Mon, Jan 14, 2013 at 8:50 AM, Alejandro Weinstein <
ale...@gm...> wrote:
> On Mon, Jan 14, 2013 at 9:42 AM, Paul Hobson <pmh...@gm...> wrote:
> > import matplotlib.pyplot as plt
> > import numpy as np
> >
> > A = np.random.rand(100,10) / 100
> > fig, ax = plt.subplots()
> > img = ax.matshow(A)
> > plt.colorbar(img)
> > fig.tight_layout()
> > plt.show()
> >
> > Does the call to tight_layout() fig your problem?
>
> Yes. This shows all the digits. There is still a lot of empty space to
> the left of the image, but that's not too bad.
>
> Interestingly, I tried before using tight_layout() as in
>
> ##################################
> A = np.random.rand(100,10) / 100
> plt.matshow(A)
> plt.colorbar()
> plt.tight_layout()
> plt.show()
> ##################################
>
> and I got the error
>
>
> /usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/figure.py:1526:
> UserWarning: This figure includes Axes that are not compatible with
> tight_layout, so its results might be incorrect.
> warnings.warn("This figure includes Axes that are not "
> Traceback (most recent call last):
> File "mp1.py", line 8, in <module>
> plt.tight_layout()
> File
> "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/pyplot.py",
> line 1150, in tight_layout
> fig.tight_layout(pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
> File
> "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/figure.py",
> line 1536, in tight_layout
> rect=rect)
> File
> "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/tight_layout.py",
> line 325, in get_tight_layout_figure
> max_nrows = max(nrows_list)
> ValueError: max() arg is an empty sequence
>
(Some of the discussion accidentally went off-list. Sorry that was my
fault.)
Same here on my Windows machine. --That-- might be bug. I'll wait for some
feedback before I create a github issue.
-paul
|