Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 88e936b

Browse files
committed
Clarify docs of Rectangle
1 parent 98dff87 commit 88e936b

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

lib/matplotlib/patches.py

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,22 @@ def draw(self, renderer):
705705

706706
class Rectangle(Patch):
707707
"""
708-
A rectangle with lower left at *xy* = (*x*, *y*) with
709-
specified *width*, *height* and rotation *angle*.
708+
A rectangle defined via an anchor point *xy* = (*x*, *y*) and it's *width*
709+
and *height*.
710+
711+
The rectangle extends from ``xy[0]`` to ``xy[0] + width`` in x-direction
712+
and from ``xy[1]`` to ``xy[1] + height`` in y-direction. ::
713+
714+
: +------------------+
715+
: | |
716+
: height |
717+
: | |
718+
: (xy)---- width -----+
719+
720+
One may picture *xy* as the bottom left corner, but which corner *xy* is
721+
actually depends on the the direction of the axis and the sign of *width*
722+
and *height*; e.g. *xy* would be the bottom right corner if the x-axis
723+
was inverted or if *width* was negative.
710724
"""
711725

712726
def __str__(self):
@@ -720,22 +734,18 @@ def __init__(self, xy, width, height, angle=0.0, **kwargs):
720734
Parameters
721735
----------
722736
xy : (float, float)
723-
The rectangle extends from xy[0] to xy[0] + width in
724-
x-direction and from xy[1] to xy[1] + height in y-direction.
737+
The anchor point.
725738
width : float
726-
Rectangle width
739+
Rectangle width.
727740
height : float
728-
Rectangle height
741+
Rectangle height.
729742
angle : float, default: 0
730743
Rotation in degrees anti-clockwise about *xy*.
731-
fill : bool, default: True
732-
Whether to fill the rectangle.
733744
734-
Notes
735-
-----
736-
Valid keyword arguments are:
737-
738-
%(Patch)s
745+
Other Parameters
746+
----------------
747+
**kwargs : `Patch` properties
748+
%(Patch)s
739749
"""
740750

741751
Patch.__init__(self, **kwargs)

0 commit comments

Comments
 (0)