From 3900f4fcade24453d19e60cf24559c141733a4ee Mon Sep 17 00:00:00 2001 From: David Stansby Date: Tue, 14 Dec 2021 19:56:13 +0000 Subject: [PATCH 1/2] Clarify coordinates for RectangleSelector properties --- lib/matplotlib/widgets.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 59631fc279bd..6a00bed673fe 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -3233,7 +3233,10 @@ def _get_rotation_transform(self): @property def corners(self): - """Corners of rectangle from lower left, moving clockwise.""" + """ + Corners of rectangle from lower left in data coordinates, + moving clockwise. + """ x0, y0, width, height = self._rect_bbox xc = x0, x0 + width, x0 + width, x0 yc = y0, y0, y0 + height, y0 + height @@ -3243,7 +3246,10 @@ def corners(self): @property def edge_centers(self): - """Midpoint of rectangle edges from left, moving anti-clockwise.""" + """ + Midpoint of rectangle edges in data coordiantes from left, + moving anti-clockwise. + """ x0, y0, width, height = self._rect_bbox w = width / 2. h = height / 2. @@ -3255,15 +3261,15 @@ def edge_centers(self): @property def center(self): - """Center of rectangle.""" + """Center of rectangle in data coordinates.""" x0, y0, width, height = self._rect_bbox return x0 + width / 2., y0 + height / 2. @property def extents(self): """ - Return (xmin, xmax, ymin, ymax) as defined by the bounding box before - rotation. + Return (xmin, xmax, ymin, ymax) in data coordinates as defined by the + bounding box before rotation. """ x0, y0, width, height = self._rect_bbox xmin, xmax = sorted([x0, x0 + width]) @@ -3360,9 +3366,8 @@ def geometry(self): """ Return an array of shape (2, 5) containing the x (``RectangleSelector.geometry[1, :]``) and - y (``RectangleSelector.geometry[0, :]``) coordinates - of the four corners of the rectangle starting and ending - in the top left corner. + y (``RectangleSelector.geometry[0, :]``) data coordinates of the four + corners of the rectangle starting and ending in the top left corner. """ if hasattr(self._selection_artist, 'get_verts'): xfm = self.ax.transData.inverted() From 10ab0fce1b8aa2534279ae59ece72889f64c5664 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 15 Dec 2021 10:33:52 +0000 Subject: [PATCH 2/2] Update lib/matplotlib/widgets.py Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --- lib/matplotlib/widgets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 6a00bed673fe..005cf96228eb 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -3234,7 +3234,7 @@ def _get_rotation_transform(self): @property def corners(self): """ - Corners of rectangle from lower left in data coordinates, + Corners of rectangle in data coordinates from lower left, moving clockwise. """ x0, y0, width, height = self._rect_bbox pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy