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

Skip to content

Commit 5220a57

Browse files
tacaswelltobias47n9e
authored andcommitted
DOC : improved docs in widgets.py
- corrected docstring in Slider.__init__ - feedback on previous commit
1 parent 89ec797 commit 5220a57

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

lib/matplotlib/widgets.py

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ class AxesWidget(Widget):
7373
"""Widget that is connected to a single
7474
:class:`~matplotlib.axes.Axes`.
7575
76-
To guarantee that the widgets stay responsive maintain a reference
77-
to them. This is necessary because the callback registry
76+
To guarantee that the widget remains responsive and not garbage-collected,
77+
a reference to the object should be maintained by the user.
78+
79+
This is necessary because the callback registry
7880
maintains only weak-refs to the functions, which are member
7981
functions of the widget. If there are no references to the widget
8082
object it may be garbage collected which will disconnect the
@@ -123,7 +125,7 @@ class Button(AxesWidget):
123125
A GUI neutral button.
124126
125127
For the button to remain responsive
126-
you much keep a reference to it.
128+
you must keep a reference to it.
127129
128130
The following attributes are accessible
129131
@@ -294,6 +296,18 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
294296
295297
Parameters
296298
----------
299+
ax : Axes
300+
The Axes to put the slider in
301+
302+
label : str
303+
Slider label
304+
305+
valmin : float
306+
The minimum value of the slider
307+
308+
valmax : float
309+
The maximum value of the slider
310+
297311
valinit : float
298312
The slider initial position
299313
@@ -304,13 +318,19 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
304318
Used to format the slider value, fprint format string
305319
306320
closedmin : bool
321+
Indicate whether the slider interval is closed on the bottom
322+
307323
closedmax : bool
308-
Indicate whether the slider interval is closed
324+
Indicate whether the slider interval is closed on the top
325+
326+
slidermin : Slider or None
327+
Do not allow the current slider to have a value less than
328+
`slidermin`
329+
330+
slidermax : Slider or None
331+
Do not allow the current slider to have a value greater than
332+
`slidermax`
309333
310-
slidermin : float
311-
slidermax : float
312-
Used to constrain the value of this slider to the values
313-
of other sliders.
314334
315335
dragging : bool
316336
if the silder can be dragged by the mouse
@@ -949,7 +969,7 @@ class MultiCursor(Widget):
949969
Provide a vertical (default) and/or horizontal line cursor shared between
950970
multiple axes.
951971
952-
For the cursor to remain responsive you much keep a reference to
972+
For the cursor to remain responsive you much keep a reference to
953973
it.
954974
955975
Example usage::

0 commit comments

Comments
 (0)