Selecting region of interest in figure

20 views
Skip to first unread message

Petro

unread,
Mar 20, 2020, 4:20:31 AM3/20/20
to Project Jupyter
Hi List.
Is there any way to select a region of interest in matplotlib figure inside of python notebook?
Thanks.
Petro.

Khoroshyy Petro

unread,
Mar 20, 2020, 4:52:07 AM3/20/20
to jup...@googlegroups.com
OK.
I solved it :
%matplotlib widget
import matplotlib.pyplot as plt
from matplotlib.widgets import LassoSelector

fig, ax = plt.subplots()

def onSelect(x):
    print(x)

lineprops = {'color': 'red', 'linewidth': 1, 'alpha': 0.8}
lsso = LassoSelector(ax=ax,
                     onselect=onSelect,
                     lineprops=lineprops,
                     useblit=False)

plt.show()

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/b269a045-65e2-44e5-a709-e9b4b50e0241%40googlegroups.com.


--
______________________________
Petro Khoroshyy
Reply all
Reply to author
Forward
0 new messages