Here is my first attempt at patch submission. This patch aims to make
it possible to set legend properties (like fontsize) in the
added legend options to rc file
To the main __init__.py file I have added lines 769-780
to set default
rc values for legend related parameters. The attached
file is just an example of setting the legend parameters.
There are several changes to legend.py:
1. added ,rcParams to the end of line 29:
from matplotlib import verbose, rcParams
2. lines 112-124 set all the defaults for the keyword
None as you suggested.
3. changed how the values for things like
self.numpoints are handled
to check if they are none and look them up from
rcParams are you
suggested lines 149-159.
I don't know if there is a way to use kwargs here
instead of the
crude dictionary I set up in this part, but it works.
Let me know if
there is a cleaner way.
4. changed line 161 to check self.isaxes instead of
isaxes now defaults to None:
if self.isaxes: # parent is an Axes
One thing I don't seem to be able to do is make the diff pick up the
matplotlibrc changes. The following lines need to be added to make
this feature useful:
legend.isaxes : True
legend.numpoints : 4 # the number of points in the legend line
legend.fontsize : 14
legend.pad : 0.2 # the fractional whitespace inside the legend border
legend.markerscale : 1.0 # the relative size of legend markers vs. original
# the following dimensions are in axes coords
legend.labelsep : 0.010 # the vertical space between the legend entries
legend.handlelen : 0.05 # the length of the legend lines
legend.handletextsep : 0.02 # the space between the legend line and legend text
legend.axespad : 0.02 # the border between the axes and legend edge
legend.shadow : False
Let me know what to do from here.
If it matters, I created the diff from inside the directory
cvs/matplotlib on my computer (I don't know if the default would be
one level up from that for most people or not).
rwklegend.patch (5.53 KB)