3
3
===================
4
4
5
5
Widgets that are designed to work for any of the GUI backends.
6
- All of these widgets require you to predefine a :class: `matplotlib.axes.Axes`
7
- instance and pass that as the first arg . matplotlib doesn't try to
6
+ All of these widgets require you to predefine a `matplotlib.axes.Axes`
7
+ instance and pass that as the first parameter . Matplotlib doesn't try to
8
8
be too smart with respect to layout -- you will have to figure out how
9
9
wide and tall you want your Axes to be to accommodate your widget.
10
10
"""
@@ -141,9 +141,9 @@ class Button(AxesWidget):
141
141
Attributes
142
142
----------
143
143
ax
144
- The :class: `matplotlib.axes.Axes` the button renders into.
144
+ The `matplotlib.axes.Axes` the button renders into.
145
145
label
146
- A :class: `matplotlib.text.Text` instance.
146
+ A `matplotlib.text.Text` instance.
147
147
color
148
148
The color of the button when not hovering.
149
149
hovercolor
@@ -281,10 +281,10 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
281
281
Used to format the slider value, fprint format string.
282
282
283
283
closedmin : bool, optional, default: True
284
- Indicate whether the slider interval is closed on the bottom.
284
+ Whether the slider interval is closed on the bottom.
285
285
286
286
closedmax : bool, optional, default: True
287
- Indicate whether the slider interval is closed on the top.
287
+ Whether the slider interval is closed on the top.
288
288
289
289
slidermin : Slider, optional, default: None
290
290
Do not allow the current slider to have a value less than
@@ -300,15 +300,15 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
300
300
valstep : float, optional, default: None
301
301
If given, the slider will snap to multiples of `valstep`.
302
302
303
- orientation : str, 'horizontal' or 'vertical', default: 'horizontal'
303
+ orientation : { 'horizontal', 'vertical'} , default: 'horizontal'
304
304
The orientation of the slider.
305
305
306
306
Notes
307
307
-----
308
308
Additional kwargs are passed on to ``self.poly`` which is the
309
- :class: `~matplotlib.patches.Rectangle` that draws the slider
310
- knob. See the :class:`~matplotlib.patches. Rectangle` documentation for
311
- valid property names (e.g., `facecolor`, ` edgecolor`, `alpha`).
309
+ `~matplotlib.patches.Rectangle` that draws the slider knob. See the
310
+ `. Rectangle` documentation for valid property names (``facecolor``,
311
+ `` edgecolor`` , `` alpha``, etc. ).
312
312
"""
313
313
if ax .name == '3d' :
314
314
raise ValueError ('Sliders cannot be added to 3D Axes' )
@@ -501,44 +501,41 @@ def reset(self):
501
501
502
502
503
503
class CheckButtons (AxesWidget ):
504
- """
504
+ r """
505
505
A GUI neutral set of check buttons.
506
506
507
507
For the check buttons to remain responsive you must keep a
508
508
reference to this object.
509
509
510
- The following attributes are exposed
511
-
512
- *ax*
513
- The :class:`matplotlib.axes.Axes` instance the buttons are
514
- located in
515
-
516
- *labels*
517
- List of :class:`matplotlib.text.Text` instances
510
+ Connect to the CheckButtons with the :meth:`on_clicked` method
518
511
519
- *lines*
512
+ Attributes
513
+ ----------
514
+ ax
515
+ The `matplotlib.axes.Axes` the button are located in.
516
+ labels
517
+ A list of `matplotlib.text.Text`\ s.
518
+ lines
520
519
List of (line1, line2) tuples for the x's in the check boxes.
521
520
These lines exist for each box, but have ``set_visible(False)``
522
521
when its box is not checked.
523
-
524
- *rectangles*
525
- List of :class:`matplotlib.patches.Rectangle` instances
526
-
527
- Connect to the CheckButtons with the :meth:`on_clicked` method
522
+ rectangles
523
+ A list of `matplotlib.patches.Rectangle`\ s.
528
524
"""
525
+
529
526
def __init__ (self , ax , labels , actives = None ):
530
527
"""
531
- Add check buttons to :class: `matplotlib.axes.Axes` instance *ax*
528
+ Add check buttons to `matplotlib.axes.Axes` instance *ax*
532
529
533
530
Parameters
534
531
----------
535
532
ax : `~matplotlib.axes.Axes`
536
533
The parent axes for the widget.
537
534
538
- labels : List[ str]
535
+ labels : list of str
539
536
The labels of the check buttons.
540
537
541
- actives : List[ bool] , optional
538
+ actives : list of bool, optional
542
539
The initial check states of the buttons. The list must have the
543
540
same length as *labels*. If not given, all buttons are unchecked.
544
541
"""
@@ -659,24 +656,21 @@ class TextBox(AxesWidget):
659
656
660
657
For the text box to remain responsive you must keep a reference to it.
661
658
662
- The following attributes are accessible:
663
-
664
- *ax*
665
- The :class:`matplotlib.axes.Axes` the button renders into.
666
-
667
- *label*
668
- A :class:`matplotlib.text.Text` instance.
669
-
670
- *color*
671
- The color of the text box when not hovering.<
F438
/span>
672
-
673
- *hovercolor*
674
- The color of the text box when hovering.
675
-
676
659
Call :meth:`on_text_change` to be updated whenever the text changes.
677
660
678
661
Call :meth:`on_submit` to be updated whenever the user hits enter or
679
662
leaves the text entry field.
663
+
664
+ Attributes
665
+ ----------
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.
680
674
"""
681
675
682
676
def __init__ (self , ax , label , initial = '' ,
@@ -686,19 +680,14 @@ def __init__(self, ax, label, initial='',
686
680
----------
687
681
ax : `~matplotlib.axes.Axes`
688
682
The `~.axes.Axes` instance the button will be placed into.
689
-
690
683
label : str
691
- Label for this text box. Accepts string.
692
-
684
+ Label for this text box.
693
685
initial : str
694
686
Initial value in the text box.
695
-
696
687
color : color
697
688
The color of the box.
698
-
699
689
hovercolor : color
700
690
The color of the box when the mouse is over it.
701
-
702
691
label_pad : float
703
692
The distance between the label and the right side of the textbox.
704
693
"""
@@ -1108,19 +1097,18 @@ def disconnect(self, cid):
1108
1097
1109
1098
class SubplotTool (Widget ):
1110
1099
"""
1111
- A tool to adjust the subplot params of a :class: `matplotlib.figure.Figure`.
1100
+ A tool to adjust the subplot params of a `matplotlib.figure.Figure`.
1112
1101
"""
1102
+
1113
1103
def __init__ (self , targetfig , toolfig ):
1114
1104
"""
1115
- *targetfig*
1105
+ Parameters
1106
+ ----------
1107
+ targetfig : `.Figure`
1116
1108
The figure instance to adjust.
1117
-
1118
- *toolfig*
1119
- The figure instance to embed the subplot tool into. If
1120
- *None*, a default figure will be created. If you are using
1121
- this from the GUI
1109
+ toolfig : `.Figure`
1110
+ The figure instance to embed the subplot tool into.
1122
1111
"""
1123
- # FIXME: The docstring seems to just abruptly end without...
1124
1112
1125
1113
self .targetfig = targetfig
1126
1114
toolfig .subplots_adjust (left = 0.2 , right = 0.9 )
@@ -1667,35 +1655,31 @@ class SpanSelector(_SelectorWidget):
1667
1655
1668
1656
Parameters
1669
1657
----------
1670
- ax : :class: `matplotlib.axes.Axes` object
1658
+ ax : `matplotlib.axes.Axes` object
1671
1659
1672
1660
onselect : func(min, max), min/max are floats
1673
1661
1674
- direction : "horizontal" or "vertical"
1675
- The axis along which to draw the span selector
1662
+ direction : { "horizontal", "vertical"}
1663
+ The direction along which to draw the span selector.
1676
1664
1677
1665
minspan : float, default is None
1678
- If selection is less than *minspan*, do not call *onselect*
1666
+ If selection is less than *minspan*, do not call *onselect*.
1679
1667
1680
1668
useblit : bool, default is False
1681
- If True, use the backend-dependent blitting features for faster
<
F987
/td>1682
- canvas updates.
1669
+ If True, use the backend-dependent blitting features for faster
1670
+ canvas updates.
1683
1671
1684
1672
rectprops : dict, default is None
1685
- Dictionary of :class: `matplotlib.patches.Patch` properties
1673
+ Dictionary of `matplotlib.patches.Patch` properties.
1686
1674
1687
1675
onmove_callback : func(min, max), min/max are floats, default is None
1688
- Called on mouse move while the span is being selected
1676
+ Called on mouse move while the span is being selected.
1689
1677
1690
1678
span_stays : bool, default is False
1691
- If True, the span stays visible after the mouse is released
1679
+ If True, the span stays visible after the mouse is released.
1692
1680
1693
- button : int or list of ints
1694
- Determines which mouse buttons activate the span selector:
1695
-
1696
- - 1: left mouse button
1697
- - 2: center mouse button (scroll wheel)
1698
- - 3: right mouse button
1681
+ button : `.MouseButton` or list of `.MouseButton`
1682
+ The mouse buttons which activate the span selector.
1699
1683
1700
1684
Examples
1701
1685
--------
@@ -1885,14 +1869,14 @@ class ToolHandles:
1885
1869
1886
1870
Parameters
1887
1871
----------
1888
- ax : :class: `matplotlib.axes.Axes`
1872
+ ax : `matplotlib.axes.Axes`
1889
1873
Matplotlib axes where tool handles are displayed.
1890
1874
x, y : 1D arrays
1891
1875
Coordinates of control handles.
1892
1876
marker : str
1893
1877
Shape of marker used to display handle. See `matplotlib.pyplot.plot`.
1894
1878
marker_props : dict
1895
- Additional marker properties. See :class: `matplotlib.lines.Line2D`.
1879
+ Additional marker properties. See `matplotlib.lines.Line2D`.
1896
1880
"""
1897
1881
1898
1882
def __init__ (self , ax , x , y , marker = 'o' , marker_props = None , useblit = True ):
@@ -2457,22 +2441,14 @@ def onselect(verts):
2457
2441
2458
2442
Parameters
2459
2443
----------
2460
- ax : :class: `~matplotlib.axes.Axes`
2444
+ ax : `~matplotlib.axes.Axes`
2461
2445
The parent axes for the widget.
2462
2446
onselect : function
2463
2447
Whenever the lasso is released, the *onselect* function is called and
2464
2448
passed the vertices of the selected path.
2465
- button : List[Int], optional
2466
- A list of integers indicating which mouse buttons should be used for
2467
- rectangle selection. You can also specify a single integer if only a
2468
- single button is desired. Default is ``None``, which does not limit
2469
- which button can be used.
2470
-
2471
- Note, typically:
2472
-
2473
- - 1 = left mouse button
2474
- - 2 = center mouse button (scroll wheel)
2475
- - 3 = right mouse button
2449
+ button : `.MouseButton` or list of `.MouseButton`, optional
2450
+ The mouse buttons used for rectangle selection. Default is ``None``,
2451
+ which corresponds to all buttons.
2476
2452
"""
2477
2453
2478
2454
def __init__ (self , ax , onselect = None , useblit = True , lineprops = None ,
@@ -2535,7 +2511,7 @@ class PolygonSelector(_SelectorWidget):
2535
2511
2536
2512
Parameters
2537
2513
----------
2538
- ax : :class: `~matplotlib.axes.Axes`
2514
+ ax : `~matplotlib.axes.Axes`
2539
2515
The parent axes for the widget.
2540
2516
onselect : function
2541
2517
When a polygon is completed or modified after completion,
@@ -2732,10 +2708,9 @@ class Lasso(AxesWidget):
2732
2708
Selection curve of an arbitrary shape.
2733
2709
2734
2710
The selected path can be used in conjunction with
2735
- :func:`~matplotlib.path.Path.contains_point` to select data points
2736
- from an image.
2711
+ `~matplotlib.path.Path.contains_point` to select data points from an image.
2737
2712
2738
- Unlike :class: `LassoSelector`, this must be initialized with a starting
2713
+ Unlike `LassoSelector`, this must be initialized with a starting
2739
2714
point `xy`, and the `Lasso` events are destroyed upon release.
2740
2715
2741
2716
Parameters
0 commit comments