How can I set the backgroundcolor of text with set_backgroundcolor ?

Hello - I want to set the backgroundcolor of text with the

    > set_backgroundcolor function. Does that actually work? I
    > saw a more complicated way to do it by defining a bbox, but
    > this would be much easier (if I got it to work). Here's my
    > example that doesn't work. Thanks for any suggestions,

Strange. When I saw your post my first thought was "hmmm, I didn't
know we had a text background color". I looked through the text.py
code and it is there as a property, but is totally unused. I don't
know who added it, but apparently someone got interrupted mid-code.
That someone could be me, but if anyone knows where this came from
speak up; otherwise it will be removed.

The bbox is the standard way to do this, and is a bit more general
since you can set the alpha, the linewidth, the edgecolor, etc...

  ax.text(1,2,'hi mom', bbox=dict(facecolor='red'))

JDH

Thanks John. This works great.
I think, however, that set_backgroundcolor would be useful.
It should be easy to fix.
If nobody speaks up, I will take a crack at it,
Mark

···

On 1/3/07, John Hunter <jdhunter@…4…> wrote:

> Hello - I want to set the backgroundcolor of text with the
> set_backgroundcolor function.  Does that actually work?  I

> saw a more complicated way to do it by defining a bbox, but
> this would be much easier (if I got it to work).  Here's my
> example that doesn't work.  Thanks for any suggestions,

Strange. When I saw your post my first thought was “hmmm, I didn’t
know we had a text background color”. I looked through the text.py
code and it is there as a property, but is totally unused. I don’t

know who added it, but apparently someone got interrupted mid-code.
That someone could be me, but if anyone knows where this came from
speak up; otherwise it will be removed.

The bbox is the standard way to do this, and is a bit more general

since you can set the alpha, the linewidth, the edgecolor, etc…

ax.text(1,2,‘hi mom’, bbox=dict(facecolor=‘red’))

JDH