On Thu, Jan 12, 2012 at 12:09 PM, Christophe Pettus <x...@thebuild.com>wrote:

> My apologies for two totally noob questions, but I can't quite seem to
> find these in the docs; a pointer would be great...
>
>
No problem.  That is what we are here for.


> 1. I would like to position a legend outside of the main plot area.  The
> positioning part works great, but the legend is clipped to the pre-existing
> figure dimensions; how can I expand the figure size horizontally to allow
> for the legend?   (And is there any way of auto-sizing the figure to
> include all of the stuff within it?)
>
>
This is actually something I deal with regularly.  I haven't found a good
solution for the interactive viewing, but when saving a figure to an image
file, you can do something like this (assume that the legend object is
stored in a variable named "leg"):

fig.savefig('foobar.png", bbox_inches='tight', pad_inches=0.25,
bbox_extra_artists=[leg])



> 2. In the horizontal bar chart I previously mentioned, the labels on the
> ticks on the Y-axis are clipped on the left side, as they are too long to
> fit into the pre-existing space.  What's the best way of allowing more
> space for the tick labels, either by contracting the chart itself or
> expanding the figure?
>
>
In mpl v1.1.0, we introduced a function called "tight_layout" which should
help with such things.  Admittedly, it would be nice if tight_layout did
something similar to bbox_inches='tight' and accept a list of additional
artist objects to consider, but it does not do that right now.

Cheers!
Ben Root
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to