Legend: Space between text and upper bo

Re: [Matplotlib-users] Legend: Space between text and upper bo
Till Wagner <sacro_thaan@…9…> writes:

leg.draw_frame(False) might be an option, but I use

self.axes.grid(True) and when the legend has no

borders, the grid is shown through the text and makes

ist nearly unredable.

I use something like this (“setp(legendframe, linewidth=0.0)” is the

crucial command):

http://matplotlib.sourceforge.net/matplotlib.pylab.html#-legend

legend(loc=‘upper left’, shadow=False)

legend = gca().get_legend()

legendtext = legend.get_texts()

legendlines = legend.get_lines()

legendframe = legend.get_frame()

setp(legendtext, fontsize=‘small’)

setp(legendlines, linewidth=1.5)

#legend.draw_frame(False) # don’t draw the legend frame

setp(legendframe, linewidth=0.0)

legendframe.set_facecolor(0.98) # set the frame face color to light gray

HTH,

Colin