Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bb64740

Browse filesBrowse files
authored
Merge pull request #14659 from anntzer/widgetdocs
Update some widget docstrings.
2 parents c221853 + 2583c7a commit bb64740
Copy full SHA for bb64740

File tree

Expand file treeCollapse file tree

1 file changed

+46
-42
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+46
-42
lines changed

‎lib/matplotlib/widgets.py

Copy file name to clipboardExpand all lines: lib/matplotlib/widgets.py
+46-42Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def ignore(self, event):
9191

9292
class AxesWidget(Widget):
9393
"""
94-
Widget that is connected to a single `~matplotlib.axes.Axes`.
94+
Widget connected to a single `~matplotlib.axes.Axes`.
9595
9696
To guarantee that the widget remains responsive and not garbage-collected,
9797
a reference to the object should be maintained by the user.
@@ -105,7 +105,7 @@ class AxesWidget(Widget):
105105
----------
106106
ax : `~matplotlib.axes.Axes`
107107
The parent axes for the widget.
108-
canvas : `~matplotlib.backend_bases.FigureCanvasBase` subclass
108+
canvas : `~matplotlib.backend_bases.FigureCanvasBase`
109109
The parent figure canvas for the widget.
110110
active : bool
111111
If False, the widget does not respond to events.
@@ -158,10 +158,10 @@ def __init__(self, ax, label, image=None,
158158
ax : `~matplotlib.axes.Axes`
159159
The `~.axes.Axes` instance the button will be placed into.
160160
label : str
161-
The button text. Accepts string.
162-
image : array-like or PIL image
163-
The image to place in the button, if not *None*.
164-
Supported inputs are the same as for `.Axes.imshow`.
161+
The button text.
162+
image : array-like or PIL Image
163+
The image to place in the button, if not *None*. The parameter is
164+
directly forwarded to `~matplotlib.axes.Axes.imshow`.
165165
color : color
166166
The color of the button when not activated.
167167
hovercolor : color
@@ -507,20 +507,19 @@ class CheckButtons(AxesWidget):
507507
For the check buttons to remain responsive you must keep a
508508
reference to this object.
509509
510-
Connect to the CheckButtons with the :meth:`on_clicked` method
510+
Connect to the CheckButtons with the `.on_clicked` method.
511511
512512
Attributes
513513
----------
514-
ax
515-
The `matplotlib.axes.Axes` the button are located in.
516-
labels
517-
A list of `matplotlib.text.Text`\ s.
518-
lines
519-
List of (line1, line2) tuples for the x's in the check boxes.
520-
These lines exist for each box, but have ``set_visible(False)``
521-
when its box is not checked.
522-
rectangles
523-
A list of `matplotlib.patches.Rectangle`\ s.
514+
ax : `~matplotlib.axes.Axes`
515+
The parent axes for the widget.
516+
labels : list of `.Text`
517+
518+
rectangles : list of `.Rectangle`
519+
520+
lines : list of (`.Line2D`, `.Line2D`) pairs
521+
List of lines for the x's in the check boxes. These lines exist for
522+
each box, but have ``set_visible(False)`` when its box is not checked.
524523
"""
525524

526525
def __init__(self, ax, labels, actives=None):
@@ -602,13 +601,19 @@ def _clicked(self, event):
602601

603602
def set_active(self, index):
604603
"""
605-
Directly (de)activate a check button by index.
606-
607-
*index* is an index into the original label list
608-
that this object was constructed with.
609-
Raises ValueError if *index* is invalid.
604+
Toggle (activate or deactivate) a check button by index.
610605
611606
Callbacks will be triggered if :attr:`eventson` is True.
607+
608+
Parameters
609+
----------
610+
index : int
611+
Index of the check button to toggle.
612+
613+
Raises
614+
------
615+
ValueError
616+
If *index* is invalid.
612617
"""
613618
if not 0 <= index < len(self.labels):
614619
raise ValueError("Invalid CheckButton index: %d" % index)
@@ -656,21 +661,21 @@ class TextBox(AxesWidget):
656661
657662
For the text box to remain responsive you must keep a reference to it.
658663
659-
Call :meth:`on_text_change` to be updated whenever the text changes.
664+
Call `.on_text_change` to be updated whenever the text changes.
660665
661-
Call :meth:`on_submit` to be updated whenever the user hits enter or
666+
Call `.on_submit` to be updated whenever the user hits enter or
662667
leaves the text entry field.
663668
664669
Attributes
665670
----------
666-
ax
667-
The `matplotlib.axes.Axes` the button renders into.
668-
label
669-
A `matplotlib.text.Text` instance.
670-
color
671-
The color of the button when not hovering.
672-
hovercolor
673-
The color of the button when hovering.
671+
ax : `~matplotlib.axes.Axes`
672+
The parent axes for the widget.
673+
label : `.Text`
674+
675+
color : color
676+
The color of the text box when not hovering.
677+
hovercolor : color
678+
The color of the text box when hovering.
674679
"""
675680

676681
def __init__(self, ax, label, initial='',
@@ -963,18 +968,18 @@ class RadioButtons(AxesWidget):
963968
For the buttons to remain responsive you must keep a reference to this
964969
object.
965970
966-
Connect to the RadioButtons with the :meth:`on_clicked` method.
971+
Connect to the RadioButtons with the `.on_clicked` method.
967972
968973
Attributes
969974
----------
970-
ax
971-
The containing `~.axes.Axes` instance.
972-
activecolor
975+
ax : `~matplotlib.axes.Axes`
976+
The parent axes for the widget.
977+
activecolor : color
973978
The color of the selected button.
974-
labels
975-
A list of `~.text.Text` instances containing the button labels.
976-
circles
977-
A list of `~.patches.Circle` instances defining the buttons.
979+
labels : list of `.Text`
980+
The button labels.
981+
circles : list of `~.patches.Circle`
982+
The buttons.
978983
value_selected : str
979984
The label text of the currently selected button.
980985
"""
@@ -2501,8 +2506,7 @@ class PolygonSelector(_SelectorWidget):
25012506
drag anywhere in the axes to move all vertices. Press the *esc* key to
25022507
start a new polygon.
25032508
2504-
For the selector to remain responsive you must keep a reference to
2505-
it.
2509+
For the selector to remain responsive you must keep a reference to it.
25062510
25072511
Parameters
25082512
----------

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.