From: Andrew B. Y. <and...@sr...> - 2006-04-19 16:09:12
|
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 $' |