Drawing on a Matplotlib Plot
It's easy to draw on a Matplotlib plot and capture the coordinates of the points by using a LassoSelector
. Here's an example script:
# function saying what to do with the vertices
=
# properties of the line to visualize what you just drew
=
# make the visualization
=
, =
Instead of merely printing the vertices, you could save them to a list for later usage. Or you could get fancy and draw them back on the plot.
I discovered this handy trick when writing SolarAnnotator, a tool to create ground truth data for solar image segmentation.
Overall, the LassoSelector
is a powerful way to enable easy annotation in a Matplotlib plot.