From: Eric F. <ef...@ha...> - 2007-09-01 07:08:06
|
Alan G Isaac wrote: > I meant to be copying an annotation example from > http://matplotlib.sourceforge.net/examples/annotation_demo.bak.py I don't see much resemblance to that example; and I haven't tried that example, but I did verify that the examples/annotation_demo.py in svn works as expected. > but it is not working. Am I just too bleary eyed because it > is later here, or is there a problem with the example? Time for bed, rest those bleary eyes... The signature of the Annotation.__init__ does not match what you were trying to feed it. Here is a modification that does match, but that may not be anything like what you were trying to do: import pylab import matplotlib as mpl test = pylab.figure() test_ax = test.gca() test_ax.plot([1,2,3]) a = mpl.text.Annotation( 'F: a figure title (points)', (-10, -10), xycoords='figure points', horizontalalignment='right', verticalalignment='top', fontsize=20) test_ax.add_artist(a) test.savefig('temp.eps') ------------------ Eric > > Thank you, > Alan Isaac > > > %%%%%%%%%%%% Illustrate Annotation Problem %%%%%%%%%%%%%%%%%%%%% > import pylab > import matplotlib as mpl > test = pylab.figure() > test_ax = test.gca() > test_ax.plot([1,2,3]) > > #the following line fails with "ValueError: too many values to unpack" > a = mpl.text.Annotation( > test, > 'F: a figure title (points)', > loc=(-10, -10), > coords='figure points', > horizontalalignment='right', > verticalalignment='top', > fontsize=20) > > test_ax.add_artist(f) > test.savefig(r'c:\temp\temp.eps') |