8000 Update RadioButtons docs numpydoc style · matplotlib/matplotlib@bdddc15 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit bdddc15

Browse files
committed
Update RadioButtons docs numpydoc style
1 parent 8466da0 commit bdddc15

File tree

2 files changed

+39
-41
lines changed

2 files changed

+39
-41
lines changed

doc/api/widgets_api.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
``matplotlib.widgets``
33
**********************
44

5+
.. inheritance-diagram:: matplotlib.widgets
6+
:parts: 1
7+
8+
59
.. automodule:: matplotlib.widgets
610
:members:
711
:undoc-members:

lib/matplotlib/widgets.py

Lines changed: 35 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -235,18 +235,17 @@ def _motion(self, event):
235235

236236
def on_clicked(self, func):
237237
"""
238-
When the button is clicked, call this *func* with event.
238+
Connect the callback function *func* to button click events.
239239
240-
A connection id is returned. It can be used to disconnect
241-
the button from its callback.
240+
Returns a connection id, which can be used to disconnect the callback.
242241
"""
243242
cid = self.cnt
244243
self.observers[cid] = func
245244
self.cnt += 1
246245
return cid
247246

248247
def disconnect(self, cid):
249-
"""remove the observer with connection id *cid*"""
248+
"""Remove the callback function with connection id *cid*."""
250249
try:
251250
del self.observers[cid]
252251
except KeyError:
@@ -648,9 +647,9 @@ def get_status(self):
648647

649648
def on_clicked(self, func):
650649
"""
651-
When the button is clicked, call *func* with button label
650+
Connect the callback function *func* to button click events.
652651
653-
A connection id is returned which can be used to disconnect
652+
Returns a connection id, which can be used to disconnect the callback.
654653
"""
655654
cid = self.cnt
656655
self.observers[cid] = func
@@ -974,40 +973,40 @@ class RadioButtons(AxesWidget):
974973
"""
975974
A GUI neutral radio button.
976975
977-
For the buttons to remain responsive
978-
you must keep a reference to this object.
979-
980-
The following attributes are exposed:
981-
982-
*ax*
983-
The :class:`matplotlib.axes.Axes` instance the buttons are in
984-
985-
*activecolor*
986-
The color of the button when clicked
976+
For the buttons to remain responsive you must keep a reference to this
977+
object.
987978
988-
*labels*
989-
A list of :class:`matplotlib.text.Text` instances
979+
Connect to the RadioButtons with the :meth:`on_clicked` method.
990980
991-
*circles*
992-
A list of :class:`matplotlib.patches.Circle` instances
993981
994-
*value_selected*
995-
A string listing the current value selected
982+
Attributes
983+
----------
984+
ax
985+
The containing `~.axes.Axes` instance.
986+
activecolor
987+
The color of the selected button.
988+
labels
989+
A list of `~.text.Text` instances containing the button labels.
990+
circles
991+
A list of `~.patches.Circle` instances defining the buttons.
992+
value_selected : str
993+
The label text of the currently selected button.
996994
997-
Connect to the RadioButtons with the :meth:`on_clicked` method
998995
"""
999996
def __init__(self, ax, labels, active=0, activecolor='blue'):
1000997
"""
1001-
Add radio buttons to :class:`matplotlib.axes.Axes` instance *ax*
1002-
1003-
*labels*
1004-
A len(buttons) list of labels as strings
998+
Add radio buttons to an `~.axes.Axes`.
1005999
1006-
*active*
1007-
The index into labels for the button that is active
1008-
1009-
*activecolor*
1010-
The color of the button when clicked
1000+
Parameters
1001+
----------
1002+
ax : `~matplotlib.axes.Axes`
1003+
The axes to add the buttons to.
1004+
labels : list of str
1005+
The button labels.
1006+
active : int
1007+
The index of the initially selected button.
1008+
activecolor : color
1009+
The color of the selected button.
10111010
"""
10121011
AxesWidget.__init__(self, ax)
10131012
self.activecolor = activecolor
@@ -1067,14 +1066,9 @@ def _clicked(self, event):
10671066

10681067
def set_active(self, index):
10691068
"""
1070-
Trigger which radio button to make active.
1071-
1072-
*index* is an index into the original label list
1073-
that this object was constructed with.
1074-
Raise ValueError if the index is invalid.
1069+
Select button with number *index*.
10751070
10761071
Callbacks will be triggered if :attr:`eventson` is True.
1077-
10781072
"""
10791073
if 0 > index >= len(self.labels):
10801074
raise ValueError("Invalid RadioButton index: %d" % index)
@@ -1098,17 +1092,17 @@ def set_active(self, index):
10981092

10991093
def on_clicked(self, func):
11001094
"""
1101-
When the button is clicked, call *func* with button label
1095+
Connect the callback function *func* to button click events.
11021096
1103-
A connection id is returned which can be used to disconnect
1097+
Returns a connection id, which can be used to disconnect the callback.
11041098
"""
11051099
cid = self.cnt
11061100
self.observers[cid] = func
11071101
self.cnt += 1
11081102
return cid
11091103

11101104
def disconnect(self, cid):
1111-
"""remove the observer with connection id *cid*"""
1105+
"""Remove the observer with connection id *cid*."""
11121106
try:
11131107
del self.observers[cid]
11141108
except KeyError:

0 commit comments

Comments
 (0)
0