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

Skip to content

Commit 2466b3b

Browse files
dstansbytimhoffm
andauthored
Clarify coordinates for RectangleSelector properties (#21952)
* Clarify coordinates for RectangleSelector properties * Update lib/matplotlib/widgets.py Co-authored-by: Tim Hoffmann <[email protected]> Co-authored-by: Tim Hoffmann <[email protected]>
1 parent 7443d88 commit 2466b3b

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

lib/matplotlib/widgets.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3233,7 +3233,10 @@ def _get_rotation_transform(self):
32333233

32343234
@property
32353235
def corners(self):
3236-
"""Corners of rectangle from lower left, moving clockwise."""
3236+
"""
3237+
Corners of rectangle in data coordinates from lower left,
3238+
moving clockwise.
3239+
"""
32373240
x0, y0, width, height = self._rect_bbox
32383241
xc = x0, x0 + width, x0 + width, x0
32393242
yc = y0, y0, y0 + height, y0 + height
@@ -3243,7 +3246,10 @@ def corners(self):
32433246

32443247
@property
32453248
def edge_centers(self):
3246-
"""Midpoint of rectangle edges from left, moving anti-clockwise."""
3249+
"""
3250+
Midpoint of rectangle edges in data coordiantes from left,
3251+
moving anti-clockwise.
3252+
"""
32473253
x0, y0, width, height = self._rect_bbox
32483254
w = width / 2.
32493255
h = height / 2.
@@ -3255,15 +3261,15 @@ def edge_centers(self):
32553261

32563262
@property
32573263
def center(self):
3258-
"""Center of rectangle."""
3264+
"""Center of rectangle in data coordinates."""
32593265
x0, y0, width, height = self._rect_bbox
32603266
return x0 + width / 2., y0 + height / 2.
32613267

32623268
@property
32633269
def extents(self):
32643270
"""
3265-
Return (xmin, xmax, ymin, ymax) as defined by the bounding box before
3266-
rotation.
3271+
Return (xmin, xmax, ymin, ymax) in data coordinates as defined by the
3272+
bounding box before rotation.
32673273
"""
32683274
x0, y0, width, height = self._rect_bbox
32693275
xmin, xmax = sorted([x0, x0 + width])
@@ -3360,9 +3366,8 @@ def geometry(self):
33603366
"""
33613367
Return an array of shape (2, 5) containing the
33623368
x (``RectangleSelector.geometry[1, :]``) and
3363-
y (``RectangleSelector.geometry[0, :]``) coordinates
3364-
of the four corners of the rectangle starting and ending
3365-
in the top left corner.
3369+
y (``RectangleSelector.geometry[0, :]``) data coordinates of the four
3370+
corners of the rectangle starting and ending in the top left corner.
33663371
"""
33673372
if hasattr(self._selection_artist, 'get_verts'):
33683373
xfm = self.ax.transData.inverted()

0 commit comments

Comments
 (0)