Skip to content

Instantly share code, notes, and snippets.

View qizhuli's full-sized avatar
🌴
On vacation

Qizhu Li qizhuli

🌴
On vacation
View GitHub Profile
@GenevieveBuckley
GenevieveBuckley / rectangle_selector_example.py
Last active June 14, 2020 23:25
Matplotlib RectangleSelector
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import RectangleSelector
def _select_rectangle_callback(eclick, erelease):
"""eclick and erelease are the press and release events"""
x1, y1 = eclick.xdata, eclick.ydata
x2, y2 = erelease.xdata, erelease.ydata