|
From: Andreas H. <li...@hi...> - 2012-07-27 08:48:57
|
Hi Francesco, >>>> I'd like to place something like a 'title' inside a legend's box. In >>>> my >>>> specific case, I have a legend with 5 entries, arranged in 5 columns, >>>> so >>>> they're horizontally next to each other in one row. Now what I'd like >>>> to >>>> have is inside the legend's box a first row (above the legend >>>> entries), >>>> where I can write some text. >>>> >>>> Any ideas? >>> >>> The keyword 'title' in legend >>> (http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.legend) >>> should work. >> >> Almost embarassingly simple ... however: It looks like the title is in a >> smaller font size than the other legend texts. Do I have some control >> about the font size of the legend's title? Couldn't find anything in the >> plt.legend docstring (I'm on 1.1.1). > > try: > l = ax.legend( patches, labels, ..., title="legend title") > t = l.get_title() #get the text object containing the title > t.set_fontsize(30) #set the font size > > you can merge the last two lines together l.get_title().set_fontsize(30) Thanks - that did the trick :) Cheers, A. |