From: <as...@us...> - 2009-09-07 20:02:46
|
Revision: 7685 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7685&view=rev Author: astraw Date: 2009-09-07 20:02:39 +0000 (Mon, 07 Sep 2009) Log Message: ----------- test conversion: move old-style test to new-style test Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/tests/test_axes.py trunk/matplotlib/test/test_plots/TestAnnotation.py Added Paths: ----------- trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_axes.png Removed Paths: ------------- trunk/matplotlib/test/test_plots/baseline/TestAnnotation/polar_axes.png Copied: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_axes.png (from rev 7684, trunk/matplotlib/test/test_plots/baseline/TestAnnotation/polar_axes.png) =================================================================== (Binary files differ) Modified: trunk/matplotlib/lib/matplotlib/tests/test_axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/tests/test_axes.py 2009-09-07 20:02:22 UTC (rev 7684) +++ trunk/matplotlib/lib/matplotlib/tests/test_axes.py 2009-09-07 20:02:39 UTC (rev 7685) @@ -58,3 +58,39 @@ xytext=(3, 3), textcoords='offset points' ) fig.savefig( 'offset_points' ) + +@image_comparison(baseline_images=['polar_axes']) +def test_polar_annotations(): + """Polar Plot Annotations""" + + # you can specify the xypoint and the xytext in different + # positions and coordinate systems, and optionally turn on a + # connecting line and mark the point with a marker. Annotations + # work on polar axes too. In the example below, the xy point is + # in native coordinates (xycoords defaults to 'data'). For a + # polar axes, this is in (theta, radius) space. The text in this + # example is placed in the fractional figure coordinate system. + # Text keyword args like horizontal and vertical alignment are + # respected + + # Setup some data + r = np.arange(0.0, 1.0, 0.001 ) + theta = 2.0 * 2.0 * np.pi * r + + fig = pylab.figure() + ax = fig.add_subplot( 111, polar=True ) + line, = ax.plot( theta, r, color='#ee8d18', lw=3 ) + + ind = 800 + thisr, thistheta = r[ind], theta[ind] + ax.plot([thistheta], [thisr], 'o') + ax.annotate('a polar annotation', + xy=(thistheta, thisr), # theta, radius + xytext=(0.05, 0.05), # fraction, fraction + textcoords='figure fraction', + arrowprops=dict(facecolor='black', shrink=0.05), + horizontalalignment='left', + verticalalignment='bottom', + ) + + fig.savefig( 'polar_axes' ) Modified: trunk/matplotlib/test/test_plots/TestAnnotation.py =================================================================== --- trunk/matplotlib/test/test_plots/TestAnnotation.py 2009-09-07 20:02:22 UTC (rev 7684) +++ trunk/matplotlib/test/test_plots/TestAnnotation.py 2009-09-07 20:02:39 UTC (rev 7685) @@ -42,45 +42,6 @@ pass #-------------------------------------------------------------------- - def testPolarAnnotations( self ): - """Polar Plot Annotations""" - - # you can specify the xypoint and the xytext in different - # positions and coordinate systems, and optionally turn on a - # connecting line and mark the point with a marker. Annotations - # work on polar axes too. In the example below, the xy point is - # in native coordinates (xycoords defaults to 'data'). For a - # polar axes, this is in (theta, radius) space. The text in this - # example is placed in the fractional figure coordinate system. - # Text keyword args like horizontal and vertical alignment are - # respected - - # Setup some data - r = npy.arange(0.0, 1.0, 0.001 ) - theta = 2.0 * 2.0 * npy.pi * r - - fname = self.outFile( "polar_axes.png" ) - - fig = figure() - ax = fig.add_subplot( 111, polar=True ) - line, = ax.plot( theta, r, color='#ee8d18', lw=3 ) - - ind = 800 - thisr, thistheta = r[ind], theta[ind] - ax.plot([thistheta], [thisr], 'o') - ax.annotate('a polar annotation', - xy=(thistheta, thisr), # theta, radius - xytext=(0.05, 0.05), # fraction, fraction - textcoords='figure fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='left', - verticalalignment='bottom', - ) - - fig.savefig( fname ) - self.checkImage( fname ) - - #-------------------------------------------------------------------- def testPolarCoordAnnotations( self ): """Polar Coordinate Annotations""" Deleted: trunk/matplotlib/test/test_plots/baseline/TestAnnotation/polar_axes.png =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |