I have an application that has 2 subplots, and I'd like to use the second to
display the legend for the first. For example, for subplots plot1 and plot2:
plot1.plot((1,2,3,4), label='up', color = 'g')
plot1.plot((4,3,2,1), label='down', color = 'b')
plot2.legend(What can I put here to display a
Hi,
Try
mylines = plot1.get_lines()
plot2.legend(mylines, [p.get_label() for p in mylines])
When you call the legend method with two arguments, first argument is
a list of lines and second argument is a list of labels. It does not
seem to matter whether lines are from same axes.
Hope this