Recently, I switched from matplotlib 0.99 to 1.0.1 and unfortunately discovered that my text scaling script stopped working properly. The script scales the given text to fit into the current figure.
A quick example of what I'm doing (works in 0.99, but not in 1.0.1 and 1.1.1rc): import matplotlib.pyplot as plt plt.ion() fig = plt.figure(1, (6,8), dpi=72) fig.add_axes([0,0,1,1]) txt1 = plt.text(0.5,0.5,'foobar',horizontalalignment='center',verticalalignment='center') plt.draw() # compute width of figure in points and divide by txt1 bounding box width sf1 = 6*72./txt1.cached.items()[0][1][1][0][1][0] txt1.set_size(txt1.get_size()*sf1) plt.draw() The problem is related to the fact that starting from mpl 1.0.1, the txt1.cached dictionary contains information of all text objects present rather than only of the specific object. I guess this behavior is intended, however this way it is rather complicated to derive the bounding box of the specific text object without cycling over the whole dictionary. Is there a different way to achieve a fitted text object? Thanks, br Jakob ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users