8000 Backport PR #21492 on branch v3.5.x (added parameter documentation for MultiCursor) by meeseeksmachine · Pull Request #21495 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Backport PR #21492 on branch v3.5.x (added parameter documentation for MultiCursor) #21495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1677,25 +1677,36 @@ class MultiCursor(Widget):

For the cursor to remain responsive you must keep a reference to it.

Example usage::
Parameters
----------
canvas : `matplotlib.backend_bases.FigureCanvasBase`
The FigureCanvas that contains all the axes.

axes : list of `matplotlib.axes.Axes`
The `~.axes.Axes` to attach the cursor to.

from matplotlib.widgets import MultiCursor
import matplotlib.pyplot as plt
import numpy as np
useblit : bool, default: True
Use blitting for faster drawing if supported by the backend.

fig, (ax1, ax2) = plt.subplots(nrows=2, sharex=True)
t = np.arange(0.0, 2.0, 0.01)
ax1.plot(t, np.sin(2*np.pi*t))
ax2.plot(t, np.sin(4*np.pi*t))
horizOn : bool, default: False
Whether to draw the horizontal line.

multi = MultiCursor(fig.canvas, (ax1, ax2), color='r', lw=1,
horizOn=False, vertOn=True)
plt.show()
vertOn: bool, default: True
Whether to draw the vertical line.

Other Parameters
----------------
**lineprops
`.Line2D` properties that control the appearance of the lines.
See also `~.Axes.axhline`.

Examples
--------
See :doc:`/gallery/widgets/multicursor`.
"""

def __init__(self, canvas, axes, useblit=True, horizOn=False, vertOn=True,
**lineprops):

self.canvas = canvas
self.axes = axes
self.horizOn = horizOn
Expand Down
0