@@ -334,6 +334,10 @@ def test_patch_str():
334334 expected = 'Arc(xy=(1, 2), width=3, height=4, angle=5, theta1=6, theta2=7)'
335335 assert str (p ) == expected
336336
337+ p = mpatches .Annulus (xy = (1 , 2 ), r = (3 , 4 ), width = 1 , angle = 2 )
338+ expected = "Annulus(xy=(1, 2), r=(3, 4), width=1, angle=2)"
339+ assert str (p ) == expected
340+
337341 p = mpatches .RegularPolygon ((1 , 2 ), 20 , radius = 5 )
338342 assert str (p ) == "RegularPolygon((1, 2), 20, radius=5, orientation=0)"
339343
@@ -595,6 +599,27 @@ def test_annulus():
595599 ax .set_aspect ('equal' )
596600
597601
602+ @image_comparison (baseline_images = ['annulus' ], extensions = ['png' ])
603+ def test_annulus_setters ():
604+
605+ fig , ax = plt .subplots ()
606+ cir = Annulus ((0. , 0. ), 0.2 , 0.01 , fc = 'g' ) # circular annulus
607+ ell = Annulus ((0. , 0. ), (1 , 2 ), 0.1 , 0 , # elliptical
608+ fc = 'm' , ec = 'b' , alpha = 0.5 , hatch = 'xxx' )
609+ ax .add_patch (cir )
610+ ax .add_patch (ell )
611+ ax .set_aspect ('equal' )
612+
613+ cir .center = (0.5 , 0.5 )
614+ cir .radii = 0.2
615+ cir .width = 0.05
616+
617+ ell .center = (0.5 , 0.5 )
618+ ell .radii = (0.5 , 0.3 )
619+ ell .width = 0.1
620+ ell .angle = 45
621+
622+
598623def test_degenerate_polygon ():
599624 point = [0 , 0 ]
600625 correct_extents = Bbox ([point , point ]).extents
0 commit comments