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

Skip to content

Commit fc69a38

Browse files
Add parameter documentation for MultiCursor (#21492)
* added parameter documentation for MultiCursor * fixed blank lines
1 parent 6dbae8b commit fc69a38

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

lib/matplotlib/widgets.py

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,25 +1677,36 @@ class MultiCursor(Widget):
16771677
16781678
For the cursor to remain responsive you must keep a reference to it.
16791679
1680-
Example usage::
1680+
Parameters
1681+
----------
1682+
canvas : `matplotlib.backend_bases.FigureCanvasBase`
1683+
The FigureCanvas that contains all the axes.
1684+
1685+
axes : list of `matplotlib.axes.Axes`
1686+
The `~.axes.Axes` to attach the cursor to.
16811687
1682-
from matplotlib.widgets import MultiCursor
1683-
import matplotlib.pyplot as plt
1684-
import numpy as np
1688+
useblit : bool, default: True
1689+
Use blitting for faster drawing if supported by the backend.
16851690
1686-
fig, (ax1, ax2) = plt.subplots(nrows=2, sharex=True)
1687-
t = np.arange(0.0, 2.0, 0.01)
1688-
ax1.plot(t, np.sin(2*np.pi*t))
1689-
ax2.plot(t, np.sin(4*np.pi*t))
1691+
horizOn : bool, default: False
1692+
Whether to draw the horizontal line.
16901693
1691-
multi = MultiCursor(fig.canvas, (ax1, ax2), color='r', lw=1,
1692-
horizOn=False, vertOn=True)
1693-
plt.show()
1694+
vertOn: bool, default: True
1695+
Whether to draw the vertical line.
16941696
1697+
Other Parameters
1698+
----------------
1699+
**lineprops
1700+
`.Line2D` properties that control the appearance of the lines.
1701+
See also `~.Axes.axhline`.
1702+
1703+
Examples
1704+
--------
1705+
See :doc:`/gallery/widgets/multicursor`.
16951706
"""
1707+
16961708
def __init__(self, canvas, axes, useblit=True, horizOn=False, vertOn=True,
16971709
**lineprops):
1698-
16991710
self.canvas = canvas
17001711
self.axes = axes
17011712
self.horizOn = horizOn

0 commit comments

Comments
 (0)