Peter-Jan,

The use of setp() is in the example script legend_demo.py, so it should still be valid.  I would suggest using that code as an example.  You must first plot the figure and the legend, before changing the legend's fontsize.

 -- Paul

On 12/12/05, Randewijk P-J <pjrandew@sun.ac.za> <pjrandew@sun.ac.za > wrote:
Dear Paul,
 
"...
setp(ltext, fontsize='large')
..."

gives me the following error:
 
"...
Traceback (most recent call last):
...
NameError: name 'ltext' is not defined
..."
 
If setp(...) is similar to matlab(tm)'s set(...)
 
then the syntax should be:
 
lh=legend(....)
 
setp(lh,fontsize=8)
 
the following error then occurs:
 
"...
Traceback (most recent call last):
...
AttributeError: Legend instance has no attribute 'set_fontsize'
..."
 
If there was an attribute 'fontsize', then:
 
"...
legend(('...'),loc='...',fontsize=10)
..."
 
Regards,
 
Peter-Jan
 
PS: The help on 'setp' refers the whole time to 'set' and not 'setp' in the help text, a.k.a. matlab(tm)'s 'set'
 
>>> help(setp)
Help on function setp in module matplotlib.pylab:
 
setp(*args, **kwargs)
    matlab(TM) and pylab allow you to use set and get to set and get
    object properties, as well as to do introspection on the object
    For example, to set the linestyle of a line to be dashed, you can do
   
      >>> line, = plot([1,2,3])
      >>> set(line, linestyle='--')
...   
 
pylab doesn't have imho a 'set' function:
 
>>> setp
<function setp at 0x01A327F0>
>>> set
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
NameError: name 'set' is not defined
 
 
-----Original Message-----
From: Paul Barrett [mailto:pebarrett@gmail.com]
Sent: 10 December 2005 22:02
To: Randewijk P-J <pjrandew@sun.ac.za>
Subject: Re: [Matplotlib-users] Help/RFC with 'legend' command

Dear P-J,

My mistake.  This may not be a bug, but a feature. The legend text size can be adjusted by using:

setp(ltext, fontsize='large')

I still think that the user should be able to adjust the default font size and have the legend font size change proportionally.

 -- Paul

On 12/10/05, Paul Barrett <pebarrett@gmail.com > wrote:
On 12/9/05, Randewijk P-J <pjrandew@sun.ac.za > < pjrandew@sun.ac.za> wrote:
Dear Paul,


> It should depend on font.size in the rc file.


That's what I thought.

I changed the font.size to 5.

Only my figtext's fontsize changed.  The legend's fontsize remained at (what appears to be) 12...

I'm still running 0.84, can that be the problem ?

No.  This is a bug in the legend code.  The code initializes the text size when the object is created, but does not update it at any later time.  This should be fixed.


 -- Paul

--
Paul Barrett, PhD                   Johns Hopkins University
Assoc. Research Scientist     Dept of Physics and Astronomy
Phone: 410-516-5190            Baltimore, MD 21218



--
Paul Barrett, PhD                   Johns Hopkins University
Assoc. Research Scientist     Dept of Physics and Astronomy
Phone: 410-516-5190            Baltimore, MD 21218



--
Paul Barrett, PhD                   Johns Hopkins University
Assoc. Research Scientist     Dept of Physics and Astronomy
Phone: 410-516-5190            Baltimore, MD 21218