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’)
comment out these lines to see text