From: <jd...@us...> - 2007-10-15 21:08:39
|
Revision: 3951 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3951&view=rev Author: jdh2358 Date: 2007-10-15 14:08:35 -0700 (Mon, 15 Oct 2007) Log Message: ----------- Fixed an annotation unit bug Added Paths: ----------- trunk/matplotlib/examples/units/annotate_with_units.py Added: trunk/matplotlib/examples/units/annotate_with_units.py =================================================================== --- trunk/matplotlib/examples/units/annotate_with_units.py (rev 0) +++ trunk/matplotlib/examples/units/annotate_with_units.py 2007-10-15 21:08:35 UTC (rev 3951) @@ -0,0 +1,27 @@ + +import pylab +from basic_units import cm + +fig = pylab.figure() +ax = fig.add_subplot(111) + + +ax.annotate( "Note 01", [0.5*cm, 0.5*cm] ) + +# xy and text both unitized +ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data', + xytext=(0.8*cm, 0.95*cm), textcoords='data', + arrowprops=dict(facecolor='black', shrink=0.05), + horizontalalignment='right', verticalalignment='top') + +# mixing units w/ nonunits +ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data', + xytext=(0.8, 0.95), textcoords='axes fraction', + arrowprops=dict(facecolor='black', shrink=0.05), + horizontalalignment='right', verticalalignment='top') + + +ax.set_xlim(0*cm, 4*cm) +ax.set_ylim(0*cm, 4*cm) +pylab.show() + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |