Skip to content

Instantly share code, notes, and snippets.

@lebedov
lebedov / lasso_imshow.py
Last active May 2, 2022 08:12
How to interactively select part of an array displayed as an image with matplotlib.
#!/usr/bin/env python
"""
How to interactively select part of an array displayed as an image with matplotlib.
"""
import matplotlib.pyplot as plt
from matplotlib.path import Path
from matplotlib.widgets import LassoSelector
import numpy as np