Created
May 11, 2019 00:15
-
-
Save DataSolveProblems/45b9c8dd7fd803858e9089de630e665d 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 LassoSelector | |
| fig, ax = plt.subplots() | |
| def onSelect(x): | |
| print(x) | |
| def onPress(event): | |
| print('Mouse pressed') | |
| def onRelease(event): | |
| print('Mouse released') | |
| lineprops = {'color': 'red', 'linewidth': 4, 'alpha': 0.8} | |
| lsso = LassoSelector(ax=ax, onselect=onSelect, lineprops=lineprops) | |
| fig.canvas.mpl_connect('button_press_event', onPress) | |
| fig.canvas.mpl_connect('button_release_event', onRelease) | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
small correction concerning LassoSelector parameter (replace lineprops with props):
++ lsso = LassoSelector(ax=ax, onselect=onSelect, props=lineprops)
-- lsso = LassoSelector(ax=ax, onselect=onSelect, lineprops=lineprops)