@@ -652,12 +652,13 @@ def draw(self, renderer):
652652class Rectangle (Patch ):
653653 """
654654 Draw a rectangle with lower left at *xy* = (*x*, *y*) with
655- specified *width* and *height *.
655+ specified *width*, *height* and rotation *angle *.
656656 """
657657
658658 def __str__ (self ):
659- return self .__class__ .__name__ \
660- + "(%g,%g;%gx%g)" % (self ._x , self ._y , self ._width , self ._height )
659+ pars = self ._x , self ._y , self ._width , self ._height , self .angle
660+ fmt = "Rectangle(xy=(%g, %g), width=%g, height=%g, angle=%g)"
661+ return fmt % pars
661662
662663 @docstring .dedent_interpd
663664 def __init__ (self , xy , width , height , angle = 0.0 , ** kwargs ):
@@ -678,7 +679,7 @@ def __init__(self, xy, width, height, angle=0.0, **kwargs):
678679 self ._y = float (xy [1 ])
679680 self ._width = float (width )
680681 self ._height = float (height )
681- self ._angle = float (angle )
682+ self .angle = float (angle )
682683 # Note: This cannot be calculated until this is added to an Axes
683684 self ._rect_transform = transforms .IdentityTransform ()
684685
@@ -700,7 +701,7 @@ def _update_patch_transform(self):
700701 height = self .convert_yunits (self ._height )
701702 bbox = transforms .Bbox .from_bounds (x , y , width , height )
702703 rot_trans = transforms .Affine2D ()
703- rot_trans .rotate_deg_around (x , y , self ._angle )
704+ rot_trans .rotate_deg_around (x , y , self .angle )
704705 self ._rect_transform = transforms .BboxTransformTo (bbox )
705706 self ._rect_transform += rot_trans
706707
@@ -1024,7 +1025,10 @@ class Wedge(Patch):
10241025 Wedge shaped patch.
10251026 """
10261027 def __str__ (self ):
1027- return "Wedge(%g,%g)" % (self .theta1 , self .theta2 )
1028+ pars = (self .center [0 ], self .center [1 ], self .r ,
1029+ self .theta1 , self .theta2 , self .width )
1030+ fmt = "Wedge(center=(%g, %g), r=%g, theta1=%g, theta2=%g, width=%s)"
1031+ return fmt % pars
10281032
10291033 @docstring .dedent_interpd
10301034 def __init__ (self , center , r , theta1 , theta2 , width = None , ** kwargs ):
@@ -1394,8 +1398,10 @@ class Ellipse(Patch):
13941398 A scale-free ellipse.
13951399 """
13961400 def __str__ (self ):
1397- return "Ellipse(%s,%s;%sx%s)" % (self .center [0 ], self .center [1 ],
1398- self .width , self .height )
1401+ pars = (self .center [0 ], self .center [1 ],
1402+ self .width , self .height , self .angle )
1403+ fmt = "Ellipse(xy=(%s, %s), width=%s, height=%s, angle=%s)"
1404+ return fmt % pars
13991405
14001406 @docstring .dedent_interpd
14011407 def __init__ (self , xy , width , height , angle = 0.0 , ** kwargs ):
@@ -1455,9 +1461,9 @@ class Circle(Ellipse):
14551461 A circle patch.
14561462 """
14571463 def __str__ (self ):
1458- return "Circle((%g,%g),r=%g)" % ( self .center [0 ],
1459- self . center [ 1 ],
1460- self . radius )
1464+ pars = self .center [0 ], self . center [ 1 ], self . radius
1465+ fmt = "Circle(xy=(%g, %g), radius=%g)"
1466+ return fmt % pars
14611467
14621468 @docstring .dedent_interpd
14631469 def __init__ (self , xy , radius = 5 , ** kwargs ):
@@ -1502,8 +1508,11 @@ class Arc(Ellipse):
15021508 with high resolution.
15031509 """
15041510 def __str__ (self ):
1505- return "Arc(%s,%s;%sx%s)" % (self .center [0 ], self .center [1 ],
1506- self .width , self .height )
1511+ pars = (self .center [0 ], self .center [1 ], self .width ,
1512+ self .height , self .angle , self .theta1 , self .theta2 )
1513+ fmt = ("Arc(xy=(%g, %g), width=%g, "
1514+ "height=%g, angle=%g, theta1=%g, theta2=%g)" )
1515+ return fmt % pars
15071516
15081517 @docstring .dedent_interpd
15091518 def __init__ (self , xy , width , height , angle = 0.0 ,
0 commit comments