method delegation in TextWithDash

Darren Dale <dd55@...143...> writes:

> OK, I refactored TextWithDash, and my changes passed backend_driver.py.
> setp(axes().get_yticklabels()) gives a comprehensive list as of svn 2206.

I fixed the bug John pointed out, and unmasked the refactored version of
TextWithDash in svn 2226.

Yes, 'size' is listed in the output now. However, now it seems that
there are too many things listed:

    label: any string
    text: string

The commands setp(gca().get_yticklabels()[0], 'label', 'foo') and
setp(..., 'text', 'foo') do nothing. Of course, the right way to
modify the tick labels is to call gca().set_yticklabels(['foo',...])
(or setp(gca(), 'yticklabels', ['foo',...])) which does quite some
magic to change the label text (e.g., the Axis object's major
formatter is changed into FixedFormatter(ticklabels)). Having 'label'
and 'text' listed in the setp output could mislead people.

However, if you draw a TextWithDash yourself, you _can_ change the
text with setp, and indeed the docstring claims that TextWithDash is
"intended to be a drop-in replacement for Text". E.g., the following
works: t=text(1,1,'foo',withdash=True); setp(t,'text', 'bar');
So it wouldn't be right to simply remove set_text from TextWithDash,
which would otherwise have been my suggestion.

···

--
Jouni