multiple legends for one subplot/pair of axes

Hi,

due to limited white space in my figures, I would like to be
able to split up a single big legend into multiple (usually 2) smaller ones.

···

###############################
Example (adapted from simple_plot.py):

from pylab import *

t = arange(0.0, 2.0, 0.01)
s = sin(2pit)
plot(t, s, linewidth=1.0)

s = sin(4pit)
plot(t, s, color=‘r’,linewidth=1.0)

grid(True)
mylegend = legend((‘Graph 1’,‘Graph 2’),

loc=‘lower right’,axespad=0.07,labelsep=0.04)

modify legend

mylegend.draw_frame(False)
mylegendtext = mylegend.get_texts()
mylegendlines = mylegend.get_lines()
setp(mylegendtext, fontsize=15)
setp(mylegendlines, linewidth=1.2)

show()
##############################

I would like to split the legend up to into two.
One for “Graph 1” and one for “Graph 2” to be
able to place them where white space is available.

Is there an easy way to do this in matplotlib?

Thanks.

  • Christian