On Mon, Jan 14, 2013 at 8:50 AM, Alejandro Weinstein <
alejandro.weinst...@gmail.com> wrote:

> On Mon, Jan 14, 2013 at 9:42 AM, Paul Hobson <pmhob...@gmail.com> 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
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to