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

Skip to content

Commit fbf431a

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

3 files changed

Lines changed: 36 additions & 39 deletions

File tree

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

File renamed without changes.

lib/matplotlib/tests/test_axes.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,39 @@ def test_basic_annotate():
5858
xytext=(3, 3), textcoords='offset points' )
5959

6060
fig.savefig( 'offset_points' )
61+
62+
@image_comparison(baseline_images=['polar_axes'])
63+
def test_polar_annotations():
64+
"""Polar Plot Annotations"""
65+
66+
# you can specify the xypoint and the xytext in different
67+
# positions and coordinate systems, and optionally turn on a
68+
# connecting line and mark the point with a marker. Annotations
69+
# work on polar axes too. In the example below, the xy point is
70+
# in native coordinates (xycoords defaults to 'data'). For a
71+
# polar axes, this is in (theta, radius) space. The text in this
72+
# example is placed in the fractional figure coordinate system.
73+
# Text keyword args like horizontal and vertical alignment are
74+
# respected
75+
76+
# Setup some data
77+
r = np.arange(0.0, 1.0, 0.001 )
78+
theta = 2.0 * 2.0 * np.pi * r
79+
80+
fig = pylab.figure()
81+
ax = fig.add_subplot( 111, polar=True )
82+
line, = ax.plot( theta, r, color='#ee8d18', lw=3 )
83+
84+
ind = 800
85+
thisr, thistheta = r[ind], theta[ind]
86+
ax.plot([thistheta], [thisr], 'o')
87+
ax.annotate('a polar annotation',
88+
xy=(thistheta, thisr), # theta, radius
89+
xytext=(0.05, 0.05), # fraction, fraction
90+
textcoords='figure fraction',
91+
arrowprops=dict(facecolor='black', shrink=0.05),
92+
horizontalalignment='left',
93+
verticalalignment='bottom',
94+
)
95+
96+
fig.savefig( 'polar_axes' )

test/test_plots/TestAnnotation.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -41,45 +41,6 @@ def tearDown( self ):
4141
"""Clean-up any generated files here."""
4242
pass
4343

44-
#--------------------------------------------------------------------
45-
def testPolarAnnotations( self ):
46-
"""Polar Plot Annotations"""
47-
48-
# you can specify the xypoint and the xytext in different
49-
# positions and coordinate systems, and optionally turn on a
50-
# connecting line and mark the point with a marker. Annotations
51-
# work on polar axes too. In the example below, the xy point is
52-
# in native coordinates (xycoords defaults to 'data'). For a
53-
# polar axes, this is in (theta, radius) space. The text in this
54-
# example is placed in the fractional figure coordinate system.
55-
# Text keyword args like horizontal and vertical alignment are
56-
# respected
57-
58-
# Setup some data
59-
r = npy.arange(0.0, 1.0, 0.001 )
60-
theta = 2.0 * 2.0 * npy.pi * r
61-
62-
fname = self.outFile( "polar_axes.png" )
63-
64-
fig = figure()
65-
ax = fig.add_subplot( 111, polar=True )
66-
line, = ax.plot( theta, r, color='#ee8d18', lw=3 )
67-
68-
ind = 800
69-
thisr, thistheta = r[ind], theta[ind]
70-
ax.plot([thistheta], [thisr], 'o')
71-
ax.annotate('a polar annotation',
72-
xy=(thistheta, thisr), # theta, radius
73-
xytext=(0.05, 0.05), # fraction, fraction
74-
textcoords='figure fraction',
75-
arrowprops=dict(facecolor='black', shrink=0.05),
76-
horizontalalignment='left',
77-
verticalalignment='bottom',
78-
)
79-
80-
fig.savefig( fname )
81-
self.checkImage( fname )
82-
8344
#--------------------------------------------------------------------
8445
def testPolarCoordAnnotations( self ):
8546
"""Polar Coordinate Annotations"""

0 commit comments

Comments
 (0)