@@ -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+
0 commit comments