Created
October 4, 2019 23:25
-
-
Save DataSolveProblems/780e5ad03cd0bd380f34644bf17ab12b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
from matplotlib.widgets import SpanSelector | |
def onselect_function(min_value, max_value): | |
print(min_value, max_value) | |
return min_value, max_value | |
fig, ax = plt.subplots() | |
ax.plot([1, 2, 3], [10, 50, 100]) | |
span = SpanSelector( | |
ax, | |
onselect=onselect_function, | |
direction='vertical', | |
minspan=40, | |
useblit=True, | |
span_stays=True, | |
button=1, | |
rectprops={'facecolor': 'yellow', 'alpha': 0.3} | |
) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment