method delegation in TextWithDash

John Hunter <jdhunter@...5...> writes:

    > label: any string
    > text: string

a 'label' is a property of any matplotlib.artist.Artist (the base
class for Line2D, Patch, Text, etc), and is used to attach a string to
any object that renders into a figure (including the Figure itself).
This is most used for auto-legending

Oh, of course. I was confused by the name "tick labels" for the text
that accompanies tick marks.

matplotlib.text.Text.set_text, however, does set the to-be-rendered
string for the Text instance.

It doesn't seem to work for tick labels. E.g.

  gca().get_xticklabels()[0].set_text('foo')

has no effect. This is quite understandable, since the text comes from
a Formatter object. It might be a neat hack to have set_text('foo')
automatically call set_xticklabels(['foo',...]).

···

--
Jouni

I dont think that can work, since set_xticklabels(['foo',...]) makes its own
call to set_text('foo').

···

On Thursday 30 March 2006 3:44 am, Jouni K Seppanen wrote:

John Hunter <jdhunter@...5...> writes:
> > label: any string
> > text: string
>
> a 'label' is a property of any matplotlib.artist.Artist (the base
> class for Line2D, Patch, Text, etc), and is used to attach a string to
> any object that renders into a figure (including the Figure itself).
> This is most used for auto-legending

Oh, of course. I was confused by the name "tick labels" for the text
that accompanies tick marks.

> matplotlib.text.Text.set_text, however, does set the to-be-rendered
> string for the Text instance.

It doesn't seem to work for tick labels. E.g.

  gca().get_xticklabels()[0].set_text('foo')

has no effect. This is quite understandable, since the text comes from
a Formatter object. It might be a neat hack to have set_text('foo')
automatically call set_xticklabels(['foo',...]).