how to center a legend

Alan said:

Ideally I'd be able to do something like lgd.set_items(lgd.get_items()[slice])

It is quite hard to modify the order of items once the legend is created. Thus, I recommend you to order your items before creating the legend. For example,

ax = subplot(111)
... plot some lines
lines = ax.get_lines()
labels = [l.get_label() for l in lines]
legend(lines[::-1], labels[::-1]

I just committed some changes to the svn which makes this kind of thing more handy. The legend guide is also updated with this.

Cool. Also, the way you demo above beats the
approach I took, so thanks for that too.



On 5/5/2009 1:35 PM Jae-Joon Lee apparently wrote: