legend fontsize in rc file

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)

Hi Ryan,

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

    isaxes=True,
    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

    shadow=False,

The only other comment I have is that in the legend __init__
*signature* you do

  def __init__(self,
               prop = FontProperties(size=rcParams['legend.fontsize']),
               ...snip):
      self.prop = prop

This sets the rc parameter at *module load time*.

Compare this with

  def __init__(self,
               prop = None,
               ...snip):
      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.

Thanks!
JDH

John,

I will make the changes shortly. How would I send you a diff? I have
used the diff feature of Vim, does that generate any file of value or
is there another script that does?

While I’m at this, is there anyway to make it possible to have two
legends for the same plot? I have plots where I overlay 2 sets of 6
things. I do this using 6 different colors and 2 different line
styles. The general nature of the legend command allowed me to make a
legend with only the 6 colors instead of all 12 lines. This is really
cool. But I would also like to add a second legend with just 2
entries, one for each line type. Basically, I think it easier to make
room for 2 small legends of 6 and 2 entries each instead of one legend
with 12 entries. It seems like if drawing a legend could be done with
an optional flag to delete the previous one, this could work. Just
browsing around in legend.py, it wasn’t obvious to me how to implement
it.

Thanks,

Ryan

John Hunter wrote:

···

<ryanfedora@…614…>http://www.hp.com/go/dualwebinarMatplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users