. Hello everybody.
I recently tried to add a text object to my plot. But when I zoom in on the text, the size of the text remains the same. I want the size of the text to increase when I zoom in and out when I decrease.
import matplotlib as mpl
fig=plt.figure()
ax1=fig.add_subplot(111)
ax1.text('','', '',position=[0.5,0.5], text='Y', fontsize='xx-small' )
Any help is appreciated. Thanks ~
Supplement-UTC + 8 04/30/2013 9:40 AM
Thanks for the offer from tcaswell. TextPath really fulfills some of my goals.
I found that there is no text path documentation on the official matplotlib website, so I look through the source code to see what it does. Finally, I achieved an excellent but satisfactory result as follows.
from matplotlib.textpath import TextPath
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.path import Path
fig=plt.figure()
ax1=fig.add_subplot(111)
tp1=TextPath((0.5,0.5), r'How do you turn this on?', size=1)
polygon=tp1.to_polygons()
for a in polygon:
p1=patches.Polygon(a)
ax1.add_patch(p1)
, . ? ?