User drawing / measuring from plot

Is there a way currently to enable a user to select points from a plot ?

  1. something similar to Matlab’s
  2. Drawing a rectangle over the plot

it’s possible to implement using the event system , my question now there an extension / system I missed ?

If not is there a plan for implementing it ?

What exactly do you mean by select? Do you mean passing that point’s value into a callback? or something else?

In short I think the answer to your question is yes it is possible but with more details on what you’re trying to accomplish it will be easier to guide you to what you need.

Are any of the examples in Gallery — Matplotlib 3.3.3 documentation close to what you are looking for?

GitHub - matplotlib/interactive_tutorial: Interactive Matplotlib tutorial may also be of interest here. The 03-temperature, 05-spectral, and 06-xrf examples are all about select points in the data and using that to update other plots.

The packages in Third party packages — Matplotlib 3.3.3 documentation may also do what you want out of the box.

Hi, Thanks for the response I’ll search if anything fits if I won’t find I’ll try to be more specific

EDIT:

mplcursors and mpldatacursor are implementing the Matlab-like selection option.
mpl-interactions has segmentation drawing which is also great
:+1:

I’ll check the gallery and tutorial and see if it’ll be easier to customize using the original Matplotlib events rather than the libraries

mpl-interactions (which was made by me :upside_down_face:) also has a widgetized scatter plot point selector you might find interesting: scatter_selector widget — mpl-interactions 0.16.2 documentation

1 Like

also for drawing a rectangle over a plot to select points you may want to check out: Lasso Selector Demo — Matplotlib 3.3.2 documentation

if that’s what you’re going for then it should be possible to modify it to use rectangleselector instead of a lasso selector :crossed_fingers: