A while back I asked whether or not I could set the legend
> fontsize from the rc file and John asked me to make it
> possible. I think I have it working, but don't know how to
> check it in to CVS and need some one else to try it. I have
> made two changes to legend.py: 1. added from matplotlib
> import rcParams (added at line 29) 2. changed the default
> parameters to the __init__ method to read from the rc: prop
> = FontProperties(size=rcParams['legend.fontsize']), (change
> line 116)
Thanks for looking into this. This is the right approach, but if we
are going to add the fontsize I think it would make more sense to
expose the other legend properties that currently have default values.
In particular, the various values in the Legend class init function
numpoints = 4, # the number of points in the legend line
prop = FontProperties(size='smaller'),
pad = 0.2, # the fractional whitespace inside the legend border
markerscale = 0.6, # the relative size of legend markers vs. original
# the following dimensions are in axes coords
labelsep = 0.005, # the vertical space between the legend entries
handlelen = 0.05, # the length of the legend lines
handletextsep = 0.02, # the space between the legend line and legend text
axespad = 0.02, # the border between the axes and legend edge
The only other comment I have is that in the legend __init__
*signature* you do
prop = FontProperties(size=rcParams['legend.fontsize']),
self.prop = prop
This sets the rc parameter at *module load time*.
Compare this with
prop = None,
if prop is None: prop = FontProperties(size=rcParams['legend.fontsize']),
self.prop = prop
This set the rc value at the time the legend is created, and thus
allows for dynamic, script based configuration of the rc properties.
The latter is what is used throughout matplotlib for rc properties.
If you are still interested in pursuing this, you can send me a diff
or your updated files and I'll check them in.