From 31005ec23227785e1ce5804c8a4eef85fe0b998c Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 27 Dec 2017 01:01:59 +0000 Subject: [PATCH 1/2] Clean LassoSelector docstring --- lib/matplotlib/widgets.py | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index f551abad778c..fc5022307837 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -2451,7 +2451,8 @@ def _rect_bbox(self): class LassoSelector(_SelectorWidget): - """Selection curve of an arbitrary shape. + """ + Selection curve of an arbitrary shape. For the selector to remain responsive you must keep a reference to it. @@ -2464,14 +2465,6 @@ class LassoSelector(_SelectorWidget): similar to :class:`RectangleSelector` and :class:`SpanSelector` and will continue to interact with the axes until disconnected. - Parameters: - - *ax* : :class:`~matplotlib.axes.Axes` - The parent axes for the widget. - *onselect* : function - Whenever the lasso is released, the `onselect` function is called and - passed the vertices of the selected path. - Example usage:: ax = subplot(111) @@ -2481,15 +2474,24 @@ def onselect(verts): print(verts) lasso = LassoSelector(ax, onselect) - *button* is a list of integers indicating which mouse buttons should - be used for rectangle selection. You can also specify a single - integer if only a single button is desired. Default is *None*, - which does not limit which button can be used. + Parameters + ---------- + ax : :class:`~matplotlib.axes.Axes` + The parent axes for the widget. + onselect : function + Whenever the lasso is released, the *onselect* function is called and + passed the vertices of the selected path. + button : list[Int], optional + A list of integers indicating which mouse buttons should be used for + rectangle selection. You can also specify a single integer if only a + single button is desired. Default is ``None``, which does not limit + which button can be used. Note, typically: - 1 = left mouse button - 2 = center mouse button (scroll wheel) - 3 = right mouse button + + - 1 = left mouse button + - 2 = center mouse button (scroll wheel) + - 3 = right mouse button """ From 5ad35668e14b063a83c226d789d65abc1f93fdb9 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 27 Dec 2017 01:04:41 +0000 Subject: [PATCH 2/2] Add attributes section --- lib/matplotlib/widgets.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index fc5022307837..cb07d8461c82 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -141,22 +141,18 @@ class Button(AxesWidget): A GUI neutral button. For the button to remain responsive you must keep a reference to it. + Call :meth:`on_clicked` to connect to the button. - The following attributes are accessible - - *ax* + Attributes + ---------- + ax : The :class:`matplotlib.axes.Axes` the button renders into. - - *label* + label : A :class:`matplotlib.text.Text` instance. - - *color* + color : The color of the button when not hovering. - - *hovercolor* + hovercolor : The color of the button when hovering. - - Call :meth:`on_clicked` to connect to the button """ def __init__(self, ax, label, image=None,