On Mon, 7 Mar 2011 09:08:29 -0600
Benjamin Root <ben.r...@ou.edu> wrote:

> Matplotlib is designed to give you maximum control over the figure elements
> while still maintaining sensible defaults.  This is helpful in some cases,
> and not so helpful in others.  In your case of placing a legend outside an
> axes, calculating the location can be a bit of a trial-and-error, but if the
> number of elements in your legend is going to be fixed, once you find a good
> value, you can just leave it that way in your script.

The problem with trial-and-error is that I can clearly see a difference of the 
sub-pixel rendering of the legend's frame when a lot of subplots are present - 
hinting at a slight-but-nonzero difference between the axis and the legend.

This bothers me at a sub-conscious level.. :)

> Automatic determination of legend size is difficult because the size of the
> text objects are not known until draw time.  However, it is possible to
> query your legend object for its bbox and then reposition your legend object
> accordingly (but only after the initial draw).  This is tricky, but do-able.

I wonder how gnuplot implements its automatic layout, since manual placement is 
never necessary, even in multiplot outputs (for those who are not familiar with 
gnuplot: multiplot implements simple grid layouts with fully automatic 
positioning of the subplots).

> By the way, another possible command you might want is called "figlegend",
> which is a legend that is attached to the figure object rather than the axes
> object.  It is plotted outside the axes, and has to be given all the objects
> to list, but it might be what you want.  See this example:

Thanks, I will look into it.


------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to