Function Repository Resource:

InteractivePointSelector

Source Notebook

Create an interactive tool for selecting points by clicking

Contributed by: Felipe Amorim

ResourceFunction["InteractivePointSelector"][]

creates an interactive tool for selecting points.

ResourceFunction["InteractivePointSelector"][n]

creates an interactive tool for selecting points, organized as an Association of n distinct classes.

Details and Options

ResourceFunction["InteractivePointSelector"] creates an interactive tool and returns a DynamicModule.
Once points are selected, clicking the "Copy" button will copy the data to the clipboard. The "Clear" button will clear all selected points.
ResourceFunction["InteractivePointSelector"] supports all options of Graphics, along with the following default value modifications and additional options:
"ClassLabels"Automaticlabels of n distinct data classes
IconizeFalseiconize selected points
PlotRange{{-10,10},{-10,10}}range of coordinates in the interactive panel
PointSizeLargesize of data points
ImageSize350size of panel
For ResourceFunction["InteractivePointSelector"][n], the default "ClassLabels" resolves to Range[n].

Examples

Basic Examples (2) 

Generate a list of points by clicking in the coordinates:

In[1]:=
ResourceFunction["InteractivePointSelector"][]
Out[1]=

Click on the "Copy" button and paste the selected points:

Out[1]=

Generate a list of points labeled into three different classes:

In[2]:=
ResourceFunction["InteractivePointSelector"][3]
Out[2]=

Click on the "Copy" button and paste the selected points:

Out[2]=

Options (5) 

Use the Iconize option to iconize the selected points:

In[3]:=
ResourceFunction["InteractivePointSelector"][2, Iconize -> True]
Out[3]=

Copy and past the iconized data:

In[4]:=
data = <|1 -> CompressedData["
1:eJwBAQL+/SFib1JlAgAAAB8AAAACAAAAaKmz18ySFMAY4Ji2hp7xP5g10iYX
nQTA8XxvHjONDUAoj3ocds4GwE40l5O2LhFAyeejuMH0FcBYoaYlk/8SQPH7
gVbAhRLAdnxB9vw/EEB/snmY840RwDHFQIK1rgZAh+NyXl8NF8A+Ixsq9gX9
P0g2GjcyPxrAZmCZsJRB8z9CgTmPoRAVwPrILxAtGPa/IT9xgp6PFMDUtURQ
j+L0v2jUEVen0vG/khwvi6Am+D8UhkTpMDkQwJs+D1ZqK+E/Nl45Iw3tHMBb
vvjbfrHcv1xzm2oz5wnAJGUyAqFp+j+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IQeB0WBHAgPepJq2Exz9y7Qu7PLYWwGDHO/0uvue/JBydZ1oaGMBclthF
UR8FwA3uDK9Y/BnAtBOm4uxSBcCGxIbEMpscwNhajZYdAADA4i0oKcB3HsBA
K75F2Yjev0gRk1Z0DR/AKLui713++D8/modCJ2IcwHBNPcL1Ov8/tDfn+iWF
GcDQODX0VTwCQABsKQ5UaRjAwBR7B7sb0D9SCmhkYm8bwNQSiru5RAJAIAuj
QYyfI8Bcml7futgIQCKwceqIrB/AzhlkJdj3EUA4Mz2les0ZwGDm/ei8c/8/
TRTrHr4GIMCcy1CC
"]|>;

See some of it:

In[5]:=
Short[data]
Out[5]=

Specify class labels with the "ClassLabels" option:

In[6]:=
ResourceFunction["InteractivePointSelector"][4, "ClassLabels" -> {"class A", "class B", "class C", "class D"}]
Out[6]=

Copy and paste the data with their class labels:

Out[6]=

Change the range of selection with the PlotRange option:

In[7]:=
ResourceFunction["InteractivePointSelector"][2, PlotRange -> {{0, 1}, {0, 1}}]
Out[7]=

Copy and paste the coordinates:

Out[7]=

Change the PointSize option:

In[8]:=
ResourceFunction["InteractivePointSelector"][2, PointSize -> 0.1]
Out[8]=

Change the ImageSize:

In[9]:=
ResourceFunction["InteractivePointSelector"][2, ImageSize -> 150]
Out[9]=

Applications (3) 

Create labeled data:

In[10]:=
ResourceFunction["InteractivePointSelector"][3, Iconize -> True]
Out[10]=

Copy and past the data:

In[11]:=
data = <|1 -> CompressedData["
1:eJwBUQGu/iFib1JlAgAAABQAAAACAAAAgLvV/z8Pzz9Ps4CXdLcDwHBua5h/
CeK/T7OAl3S3A8DYWQdxK0f1vzVnKz06TgLAKJEfV3+6+78ukHsXtlr9vxCP
dv35jP6/HEQauyJ89L+AaCy47xgCwNxVp7vrVd6/8N422CB+AcA2jqxhMhva
P1iDmV2qHfq/f8pPc4Bf7D+wNdpKdQnwv/Km5Nqz2PU/oBMDlCDV1788OMwS
vtz3PyBruVavdN0/cM/DLKV29j+QCIGEVWfoPzTDm+lxD/Y/kNzJYXF59T92
rlJzMqTzP3D7kcFeHvs/Eeu4rXn25z8InAe3PZUAQGgUwe33ccI/nCX9lgww
AUC6wbBt+3rdv7iWovB0/ABAP5EWrpGo8r/IETnuP7/+P1Dddwolh/u/GOXq
lH199z88EQv1pssBwOD9tvfDNek/o6iGzkoDBMCdkqkQ
"], 2 -> {{-0.6923913109202005, -0.3315857317008239}, {-0.28923512690777997`, 0.0715704523115972}, {-0.6419930088018138, 0.39913296226327144`}, {-1.0451491928142342`, 0.1471603472555083}, {
    0.9156455772911709, -0.35678488276001796`}, {
    0.6132784392818547, -0.0040232217491495414`}, {1.016434623294277, 0.2983439162601662}, {1.369192505188309, -0.07961311669306076}}, 3 -> {{-1.1961475850939518`, -0.9927989088261824}, {-0.8937804470846356, -1.2951660468354982`}, {-0.49062426307221507`, -1.4715449877825146`}, {-0.1630579740037046, -1.597533184844814}, {
    0.1645007568311332, -1.597533184844814}, {
    0.6432543940211364, -1.5219395107840672`}, {
    0.9204223809712584, -1.3455605698370507`}, {
    1.128561019803918, -1.2117288157826462`}}|>;

Test different classification methods on the data and visualize them with ResourceFunction["DecisionBoundaryPlot"]:

In[12]:=
With[{methods = {"LogisticRegression", "NeuralNetwork", "RandomForest",
     "SupportVectorMachine"}}, GraphicsGrid[
  Partition[
   Table[ResourceFunction["DecisionBoundaryPlot"][data, Method -> method, PlotLabel -> method], {method, methods}], 2]]]
Out[12]=

Possible Issues (1) 

Labels must match the number of classes:

In[13]:=
ResourceFunction["InteractivePointSelector"][3, "ClassLabels" -> {"A", "B"}]
Out[13]=

Publisher

Felipe Amorim

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.0 – 12 September 2025

Related Resources

License Information