From: Andrew K. <ndr...@gm...> - 2009-08-14 00:53:40
|
I am currently using the annotate() method for my data points and I was curious if there is a way to center a line of text relative to a line of text below it. I am currently using two annotate() function calls in a row (I need the text to be different colors) but I need the first one to act as a title for the second (i.e. so I want it centered relative to the one below.) I have tried to use the length of the second bit of text to center but I just cannot seem to do it. The code looks sort of like this: import matplotlib.pyplot as plt ....... annotateTitle='Title' annotateText='Blah, Blah, Blah' plt.annotate(annotateTitle, xy=(1,1), xytext=(20,50), xycoords='data', textcoords='offset points') plt.annotate(annotateText, xy=(1,1), xytext=(20,20), xycoords='data', textcoords='offset points', size='small', color='black') Any ideas? -Andy |