From 9149d8c239b0fbd0e66f9cf7a6c37e73d594c17e Mon Sep 17 00:00:00 2001 From: David Stansby Date: Thu, 21 Sep 2017 17:07:30 +0100 Subject: [PATCH] Backport PR #9031: Added RectangleSelector.geometry docstring Docstring contains details specific to RectangleSelector and does not fully generalize to EllipseSelector. PR Summary Matplotlib documentation is missing details concerning the geometry attribute for RectangleSelector. This change provides a docstring for said attribute which is specific to RectangleSelector and not generalizable to EllipseSelector. PR Checklist - [ x] Has Pytest style unit tests - [ x] Code is PEP 8 compliant - [ x] New features are documented, with examples if plot related - [ x] Documentation is sphinx and numpydoc compliant - [ x] Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there) - [x ] Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way --- lib/matplotlib/widgets.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 2c395250b2e5..8b4055643a74 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -2334,6 +2334,13 @@ def _set_active_handle(self, event): @property def geometry(self): + """ + Returns numpy.ndarray of shape (2,5) containing + 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. + """ if hasattr(self.to_draw, 'get_verts'): xfm = self.ax.transData.inverted() y, x = xfm.transform(self.to_draw.get_verts()).T