|
From: Ryan K. <rya...@co...> - 2005-07-11 23:29:03
|
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) I made one change to __init__.py. A default value needs to be added for legend.fontsize: #legend properties 'legend.fontsize' : ['small',validate_fontsize], (lines 645-646) From there I added the following to my matplotlibrc file and it seems to work: ### Legend legend.fontsize : 16 (lines 149-150) Please let me know what else I need to do. I don't think I have access to upload stuff to sourceforge (nor am I sure I should be given that power). Ryan |
|
From: John H. <jdh...@ac...> - 2005-07-12 18:37:24
|
>>>>> "Ryan" == Ryan Krauss <rya...@co...> writes:
Ryan> A while back I asked whether or not I could set the legend
Ryan> fontsize from the rc file and John asked me to make it
Ryan> possible. I think I have it working, but don't know how to
Ryan> check it in to CVS and need some one else to try it. I have
Ryan> made two changes to legend.py: 1. added from matplotlib
Ryan> import rcParams (added at line 29) 2. changed the default
Ryan> parameters to the __init__ method to read from the rc: prop
Ryan> = FontProperties(size=rcParams['legend.fontsize']), (change
Ryan> 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
|
|
From: Ryan K. <rya...@co...> - 2005-07-12 20:22:53
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
John,<br>
<br>
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?<br>
<br>
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.<br>
<br>
Thanks,<br>
<br>
Ryan<br>
<br>
<br>
John Hunter wrote:
<blockquote cite="mid...@pe..."
type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">"Ryan" == Ryan Krauss <a class="moz-txt-link-rfc2396E" href="mailto:rya...@co..."><rya...@co...></a> writes:
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->
Ryan> A while back I asked whether or not I could set the legend
Ryan> fontsize from the rc file and John asked me to make it
Ryan> possible. I think I have it working, but don't know how to
Ryan> check it in to CVS and need some one else to try it. I have
Ryan> made two changes to legend.py: 1. added from matplotlib
Ryan> import rcParams (added at line 29) 2. changed the default
Ryan> parameters to the __init__ method to read from the rc: prop
Ryan> = FontProperties(size=rcParams['legend.fontsize']), (change
Ryan> 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
-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA. To register visit <a class="moz-txt-link-freetext" href="http://www.hp.com/go/dualwebinar">http://www.hp.com/go/dualwebinar</a>
_______________________________________________
Matplotlib-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Mat...@li...">Mat...@li...</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/matplotlib-users">https://lists.sourceforge.net/lists/listinfo/matplotlib-users</a>
</pre>
</blockquote>
<br>
</body>
</html>
|