Hi, I just discovered matplotlib, it seems really cool &
> just what I have been looking for.
> I have a hopefully simple question: How can I change the
> font size and type of the legend, and how can I remove the
> frame around the legend?
Right now there are no nice functions to access the attributes of the
legend, though they will be easy to add. Basically, we need things
leg = axes.get_legend() # return the axes Legend instance
leg.get_texts() # return the Text instances in the legend
leg.get_lines() # return the Line2D instances in the legend
leg.get_patches()# return the Patch instance in the legend
leg.get_frame() # return the Rectangle bounding box
Here is some code that accesses the attributes directly. Not elegant,
but may get you what you want until proper accessor methods are added
Eg, in legend_demo, you could write
texts = gca()._legend._texts
set(texts, 'fontsize', 14) # use big fonts for the legend text
set(texts, 'fontname, 'courier') # change the fontname
box = gca()._legend._patch # the Rectangle instance containing the legend
box.set_facecolor('b') # make the legend frame blue
handles = gca()._legend._handles # the line / patch instance inside the legend
See the Line2D, Text and Patch classes in matplotlib.lines,
matplotlib.text and matplotlib.patches for information on what
attributes you can set for each of these types.
If you want to add the required methods to axes and legend to expose
these attributes, it is not hard -- send me a patch. Otherwise I'll
put it on my list of things to do.