Interactively select points in Julia plot

168 views Asked by At

I want to select interactively points from a plot (I usually use Makie, but it is not necessary). I would like to perform an area selection creating a polygon over points. My idea is to click with the mouse around the points I want to select and create a polygon box, but i don't know how. I alrady have a function that select points from polygon areas, but I would like to make it interactive.

I use a function like this to select points:

using PolygonOps

# Box
xv = [-10 210 210 -10 -10]
yv = [-10 -10 10 10 -10]

# Poligon over the Box
polygon = SVector.(xv, yv)

# Points from coordinates
points = vec(SVector.(coord[:, 2], coord[:, 3]))

# Find inside
inside = [inpolygon(p, polygon; in=true, on=false, out=false) for p in points]

I would like to make it interactive, meaning that xv and yv vectors should be made by selecting points on plot using mouse click

0

There are 0 answers