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

Skip to content

Commit 029be1f

Browse files
committed
test conversion: move old-style test to new-style test
svn path=/trunk/matplotlib/; revision=7686
1 parent fbf431a commit 029be1f

3 files changed

Lines changed: 34 additions & 78 deletions

File tree

test/test_plots/baseline/TestAnnotation/polar_coords.png renamed to lib/matplotlib/tests/baseline_images/test_axes/polar_coords.png

File renamed without changes.

lib/matplotlib/tests/test_axes.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,37 @@ def test_polar_annotations():
9494
)
9595

9696
fig.savefig( 'polar_axes' )
97+
98+
#--------------------------------------------------------------------
99+
@image_comparison(baseline_images=['polar_coords'])
100+
def test_polar_coord_annotations():
101+
"""Polar Coordinate Annotations"""
102+
103+
# You can also use polar notation on a catesian axes. Here the
104+
# native coordinate system ('data') is cartesian, so you need to
105+
# specify the xycoords and textcoords as 'polar' if you want to
106+
# use (theta, radius)
107+
from matplotlib.patches import Ellipse
108+
el = Ellipse((0,0), 10, 20, facecolor='r', alpha=0.5)
109+
110+
fig = pylab.figure()
111+
ax = fig.add_subplot( 111, aspect='equal' )
112+
113+
ax.add_artist( el )
114+
el.set_clip_box( ax.bbox )
115+
116+
ax.annotate('the top',
117+
xy=(np.pi/2., 10.), # theta, radius
118+
xytext=(np.pi/3, 20.), # theta, radius
119+
xycoords='polar',
120+
textcoords='polar',
121+
arrowprops=dict(facecolor='black', shrink=0.05),
122+
horizontalalignment='left',
123+
verticalalignment='bottom',
124+
clip_on=True, # clip to the axes bounding box
125+
)
126+
127+
ax.set_xlim( -20, 20 )
128+
ax.set_ylim( -20, 20 )
129+
fig.savefig( 'polar_coords' )
130+

test/test_plots/TestAnnotation.py

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)