Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 90c0083

Browse files
committed
Fixed an annotation unit bug
svn path=/trunk/matplotlib/; revision=3951
1 parent f31a8d4 commit 90c0083

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
import pylab
3+
from basic_units import cm
4+
5+
fig = pylab.figure()
6+
ax = fig.add_subplot(111)
7+
8+
9+
ax.annotate( "Note 01", [0.5*cm, 0.5*cm] )
10+
11+
# xy and text both unitized
12+
ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data',
13+
xytext=(0.8*cm, 0.95*cm), textcoords='data',
14+
arrowprops=dict(facecolor='black', shrink=0.05),
15+
horizontalalignment='right', verticalalignment='top')
16+
17+
# mixing units w/ nonunits
18+
ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data',
19+
xytext=(0.8, 0.95), textcoords='axes fraction',
20+
arrowprops=dict(facecolor='black', shrink=0.05),
21+
horizontalalignment='right', verticalalignment='top')
22+
23+
24+
ax.set_xlim(0*cm, 4*cm)
25+
ax.set_ylim(0*cm, 4*cm)
26+
pylab.show()
27+

0 commit comments

Comments
 (0)