On Thu, Jan 29, 2009 at 3:30 PM, Evans, James R
<james.r.ev...@jpl.nasa.gov> wrote:
> Is there a reason why Axis.get_label returns the label as a Text instance, or 
> should there really be set_label/get_label methods that takes a string and 
> set the text value of the Text instance and returns the string value of the 
> Text instance?
>
> Everywhere it is used in the code it is used in a two-step process to really 
> just get and set the string value of the Text instance.

I don't think there is an easy answer to this one.  Many of the axis
getters return either artists or lists of artists, so I am
disinclined to change the behavior since it does what it is documented
to do and it is a minor inconvenience to have to "get_text".  The end
user might just as well want to set the font color, so returning the
text instance facilitates that.  What makes it trickier is that
"label" is overloaded here, as all artists have a label property (eg
the legend uses the label property for autolegending) which *is* a
simple string.  It's a bit more confusing still because the Axes
accessor methods *do* convert these labels to strings, eg
ax.get_xlabel and ax.get_xticklabels.

To solve the label property clash, a better name would probably be
"axislabel" or something like that, but I'm -0 on doing anything about
it since in practice noone is using the label property in this way
(though someone may want to down the road) .  If there is a compelling
use case for fixing it I'm amenable, but it looks more like a wart
that is worth keeping rather than breaking someone's code is a way
that may take them a while to figure out.

JDH

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to