-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Expand file tree
/
Copy pathmulticursor.py
More file actions
38 lines (31 loc) · 911 Bytes
/
multicursor.py
File metadata and controls
38 lines (31 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
===========
Multicursor
===========
Showing a cursor on multiple plots simultaneously.
This example generates three axes split over two different figures. On
hovering the cursor over data in one subplot, the values of that datapoint are
shown in all axes.
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import MultiCursor
t = np.arange(0.0, 2.0, 0.01)
s1 = np.sin(2*np.pi*t)
s2 = np.sin(3*np.pi*t)
s3 = np.sin(4*np.pi*t)
fig, (ax1, ax2) = plt.subplots(2, sharex=True)
ax1.plot(t, s1)
ax2.plot(t, s2)
fig, ax3 = plt.subplots()
ax3.plot(t, s3)
multi = MultiCursor(None, (ax1, ax2, ax3), color='r', lw=1)
plt.show()
#############################################################################
#
# .. admonition:: References
#
# The use of the following functions, methods, classes and modules is shown
# in this example:
#
# - `matplotlib.widgets.MultiCursor`