From: <as...@us...> - 2009-09-07 20:03:05
|
Revision: 7686 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7686&view=rev Author: astraw Date: 2009-09-07 20:02:56 +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 Added Paths: ----------- trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_coords.png Removed Paths: ------------- trunk/matplotlib/test/test_plots/TestAnnotation.py trunk/matplotlib/test/test_plots/baseline/TestAnnotation/polar_coords.png Copied: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_coords.png (from rev 7685, trunk/matplotlib/test/test_plots/baseline/TestAnnotation/polar_coords.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:39 UTC (rev 7685) +++ trunk/matplotlib/lib/matplotlib/tests/test_axes.py 2009-09-07 20:02:56 UTC (rev 7686) @@ -94,3 +94,37 @@ ) fig.savefig( 'polar_axes' ) + + #-------------------------------------------------------------------- +@image_comparison(baseline_images=['polar_coords']) +def test_polar_coord_annotations(): + """Polar Coordinate Annotations""" + + # You can also use polar notation on a catesian axes. Here the + # native coordinate system ('data') is cartesian, so you need to + # specify the xycoords and textcoords as 'polar' if you want to + # use (theta, radius) + from matplotlib.patches import Ellipse + el = Ellipse((0,0), 10, 20, facecolor='r', alpha=0.5) + + fig = pylab.figure() + ax = fig.add_subplot( 111, aspect='equal' ) + + ax.add_artist( el ) + el.set_clip_box( ax.bbox ) + + ax.annotate('the top', + xy=(np.pi/2., 10.), # theta, radius + xytext=(np.pi/3, 20.), # theta, radius + xycoords='polar', + textcoords='polar', + arrowprops=dict(facecolor='black', shrink=0.05), + horizontalalignment='left', + verticalalignment='bottom', + clip_on=True, # clip to the axes bounding box + ) + + ax.set_xlim( -20, 20 ) + ax.set_ylim( -20, 20 ) + fig.savefig( 'polar_coords' ) + Deleted: trunk/matplotlib/test/test_plots/TestAnnotation.py =================================================================== --- trunk/matplotlib/test/test_plots/TestAnnotation.py 2009-09-07 20:02:39 UTC (rev 7685) +++ trunk/matplotlib/test/test_plots/TestAnnotation.py 2009-09-07 20:02:56 UTC (rev 7686) @@ -1,78 +0,0 @@ -#======================================================================= -"""The Annotation unite-test class implementation.""" -#======================================================================= - -from mplTest import * - -#======================================================================= -# Add import modules below. -import matplotlib -matplotlib.use( "Agg", warn = False ) - -from matplotlib.pyplot import figure -from matplotlib.patches import Ellipse -import numpy as npy -# -#======================================================================= - -#======================================================================= -class TestAnnotation( MplTestCase ): - """Annotation unit test class.""" - - # Uncomment any appropriate tags - tags = [ - # 'gui', # requires the creation of a gui window - 'agg', # uses agg in the backend - 'agg-only', # uses only agg in the backend - # 'wx', # uses wx in the backend - # 'qt', # uses qt in the backend - # 'ps', # uses the postscript backend - # 'units', # uses units in the test - 'PIL', # uses PIL for image comparison - ] - - #-------------------------------------------------------------------- - def setUp( self ): - """Setup any data needed for the unit test.""" - pass - - #-------------------------------------------------------------------- - def tearDown( self ): - """Clean-up any generated files here.""" - pass - - #-------------------------------------------------------------------- - def testPolarCoordAnnotations( self ): - """Polar Coordinate Annotations""" - - # You can also use polar notation on a catesian axes. Here the - # native coordinate system ('data') is cartesian, so you need to - # specify the xycoords and textcoords as 'polar' if you want to - # use (theta, radius) - - el = Ellipse((0,0), 10, 20, facecolor='r', alpha=0.5) - - fname = self.outFile( "polar_coords.png" ) - - fig = figure() - ax = fig.add_subplot( 111, aspect='equal' ) - - ax.add_artist( el ) - el.set_clip_box( ax.bbox ) - - ax.annotate('the top', - xy=(npy.pi/2., 10.), # theta, radius - xytext=(npy.pi/3, 20.), # theta, radius - xycoords='polar', - textcoords='polar', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='left', - verticalalignment='bottom', - clip_on=True, # clip to the axes bounding box - ) - - ax.set_xlim( -20, 20 ) - ax.set_ylim( -20, 20 ) - fig.savefig( fname ) - self.checkImage( fname ) - Deleted: trunk/matplotlib/test/test_plots/baseline/TestAnnotation/polar_coords.png =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |