I want to draw some text and have it clipped by another rectangle I draw.  The 
text should only display inside the box.  I have some sample code that seems 
like it should work, but obviously there is something wrong because the text 
does not display at all.  Any help?

import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)

mybar, = ax.bar(0,1)

mytext = ax.text(0.5, 0.5, 'text inside box')
mytext2 = ax.text(-0.3, 0.2, 'text outside box')

ax.set_xlim(-1.5, 2.0)
ax.set_ylim(-1.0, 2.5)

fig.canvas.draw()

# comment out these lines to see text
mytext.set_clip_on(True)
mytext.set_clip_box(mybar.get_bbox())
mytext2.set_clip_on(True)
mytext2.set_clip_box(mybar.get_bbox())

plt.show()

Thanks,
-Ben
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to