Matthias Michler wrote:
> - I think this could be a good improvement, but i'm not sure if it is easy to 
> expand the functionality of the axes-legend (pyplot.legend or ax.legend) to 
> that of a figure-legend(pyplot.figlegend or fig.legend with fig as a figure 
> instance) without missing something, because there is no axes specified and 
> therefore it is not obvious which lines should be displayed. 

True, although if there's only one axes, it's obvious ;-)
(and if there's more than one, it should take an axes as a keyword 
parameter)

> In that case the 
> default behaviour might become to take all lines from all axes and that's not 
> what one always needs, or isn't it?  

Who knows, maybe someone would want that? The joy of building generic 
tools ;-)

> ax1 = subplot(111)
> # some plotting commands
> labels = []
> for line in ax1.lines:
>      label = line.get_label()
>      labels.append(label)
> # or in one line: 
> # labels = [line.get_label() for line in ax1.lines]
> figlegend(ax1.lines, labels, 'upper right')

Yes, you see, it just feels to me like figlegend should have this code 
in it as it's likely to be duplicated every time I need to call figlegend.

Why not just?

figlegend(axes=ax1,'upper right')

>> - it places the legend over the top of the current chart, I want it to
>> the right, so it doesn't obscure the information on the chart...
> 
> That's true and I have no idea how to overcome that (except for example 
> subplot_adjust(top=0.8)).

Yes, I'm just making do with this for now, but it would be really nice 
if MPL supported legends outsite the axes properly.

It would also be good if you didn't have to manually fiddle with 
subplot_adjust because you rotated the labels for the x-axis through 90 
degrees :-(

>> How does figure.legend interact with subplots?
> I'm don't know, but maybe it doesn't interact with the axes / subplots at all.

'badly' I think is the best summary of the interaction ;-)

> I think in that case the axes-legend is the preferred one, but I have no idea 
> how to ensure that nothing is cover by the legend without difficult tuning of 
> the parameters or at least ensure that all labels have the same widths.

Yeah :-/ This is where I am... If anyone has any magic code or 
suggestions, I'd love to hear 'em ;-)

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to