Hi
In one part of my script I plot some lines
and assign labels to the lines.
Later in the script I create a figure legend.
How do I get the labels, that I assigned at plot-time, to
be used in the legend? Currently I am manually
specifying the legend labels.
# Plot some lines ... set values for the labels
ax.plot(r.date, r.FSA, label='FSA-Load-Pct')
ax.plot(r.date, r.FSB, label='FSB-Load-Pct')
ax.plot(r.date, r.Heap, label='Heap-Use-Pct')
.
.
.
.
.
# now setup the legend for the figure
# It would be nice to be able to use the labels already assigned
# to the lines .. rather than having to manually respecify the labels for
# the legend
mylines=ax.get_lines()
# mylables=ax.get_line_labels() I WISH THIS WAS POSSIBLE !!
# this is one line may wrap in the email message
figlegend = fig0.legend(mylines,
('FSA-Load-Pct','FSB-Load-Pct','Heap-Use-Pct'), loc=(0.5,0.01),
prop=matplotlib.font_manager.FontProperties(size='smaller'))
Thanks
Andy
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users