How to obscure underlying text?

How can one partially overlay text on top of text so as to obscure
the underlying text?

I want to print a beginning date at (0,0) and the current date
at (0.1,0) such that the current date's bounding box masks the
underlying beginning date. What currently happens is the two dates
blend together to form a mess. (I am creating an mpeg4 where the
current date marches from beginning to end.)

I have tried two things: set a bounding box, set a background color.

  rectangle = matplotlib.patches.Rectangle( (0,0), 0, 0 )
  rectangle.set_fill( True )

  # Drawing beginning date
  s = "%s UTC" % beginning.strftime( "%Y-%m-%d %H:%M" )
  t = matplotlib.text.Text( 0.0, 0.0, s )
  t.set_bbox( rectprops = rectangle.__dict__ )
  t.set_backgroundcolor( color='r' )
  axes.add_artist( t )

  # Draw current date
  txt = "%s UTC" % now.strftime( "%Y-%m-%d %H:%M" )
  t = matplotlib.text.Text( x, 0.0, s )
  t.set_bbox( rectprops = rectangle.__dict__ )
  t.set_backgroundcolor( color='r' )
  axes.add_artist( t )

The set_background color seems to do nothing.
The set_bbox raises the following--
  File "/usr/lib/python2.4/site-packages/matplotlib/artist.py", line 193, in update
    raise AttributeError('Unknown property %s'%k)
AttributeError: Unknown property _facecolor

Thanks,
Andrew
Python 2.4, __version__ = '0.85', __revision__ = '$Revision: 1.83 $'

Found my answer:
  rectprops = { 'fill': True, 'facecolor': 'w', 'edgecolor': 'w' }
  t.set_bbox( rectprops = rectprops )

Does anyone find the documentation extremely sparse? I am new to
this library and while find the OO design pretty good, struggle with
what's on http://matplotlib.sourceforge.net/classdocs.html. Is there more?

In this case I had to--
View the text.py to see what set_bbox and draw do,
created a Rectangle and print its __dict__ to see what it's attributes are,
realize I must strip leading '_' by seeing how update works in artist.py,
just to write two lines of code.

--andyy

Andrew B. Young wrote:

···

How can one partially overlay text on top of text so as to obscure
the underlying text?

I want to print a beginning date at (0,0) and the current date
at (0.1,0) such that the current date's bounding box masks the
underlying beginning date. What currently happens is the two dates
blend together to form a mess. (I am creating an mpeg4 where the
current date marches from beginning to end.)

I have tried two things: set a bounding box, set a background color.

rectangle = matplotlib.patches.Rectangle( (0,0), 0, 0 )
rectangle.set_fill( True )

# Drawing beginning date
s = "%s UTC" % beginning.strftime( "%Y-%m-%d %H:%M" )
t = matplotlib.text.Text( 0.0, 0.0, s )
t.set_bbox( rectprops = rectangle.__dict__ )
t.set_backgroundcolor( color='r' )
axes.add_artist( t )

# Draw current date
txt = "%s UTC" % now.strftime( "%Y-%m-%d %H:%M" )
t = matplotlib.text.Text( x, 0.0, s )
t.set_bbox( rectprops = rectangle.__dict__ )
t.set_backgroundcolor( color='r' )
axes.add_artist( t )

The set_background color seems to do nothing.
The set_bbox raises the following--
File "/usr/lib/python2.4/site-packages/matplotlib/artist.py", line 193, in update
   raise AttributeError('Unknown property %s'%k)
AttributeError: Unknown property _facecolor

Thanks,
Andrew
Python 2.4, __version__ = '0.85', __revision__ = '$Revision: 1.83 $'

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users