# Ploting a dataset and choosing points from the plot

I have the following:

data = {{643.5, 780.5}, {659.5, 780.5}, {627.5, 761.5}, {643.5, 761.5}, {659.5, 761.5}, {627.5, 742.5}, {643.5, 742.5}, {659.5, 742.5}, {627.5, 723.5}, {643.5, 723.5}}


where its plot is:

ListPlot[data, PlotStyle -> Black]


From the plot, I want to choose, let's say, three points, and cut and paste them in order to make a new list. For this, I click on the plot and choose one point where its color becomes orange. My question is: 1. How can I choose three points at once? and 2. How can I cut and paste their coordinates into a new list, instead of reading them from the dataset in the above?

• See Get Coordinates From Graphics However, if you can specify some criteria it would be easier and more accurate to use Select or Cases or ... Commented Nov 21, 2022 at 13:45
• " how can I realize to which point in my dataset corresponds" -> Do you mean the position of the point in the dataset ? like first, 2nd, 12th etc ? Commented Nov 21, 2022 at 17:44

data = {{643.5, 780.5}, {659.5, 780.5}, {627.5, 761.5}, {643.5,
761.5}, {659.5, 761.5}, {627.5, 742.5}, {643.5, 742.5}, {659.5,
742.5}, {627.5, 723.5}, {643.5, 723.5}} // Sort;


Using Manipulate with a TogglerBar

Manipulate[
Grid[
{{ListPlot[
({remaining, choosen} =
{Complement[data, selected],
selected}) /.
{} :> Nothing,
PlotRange -> All,
PlotMarkers -> {If[remaining === {},
Style["■", Orange, 16],
Style["●", Blue]],
Style["■", Orange, 16]}],
SpanFromLeft},
{"remaining", "choosen"},
{remaining, choosen}},
Frame -> All],
{{selected, {}},
ControlType -> TogglerBar}]


EDIT: Added Tooltip and better formatting.

Manipulate[
Grid[{{
ListPlot[
({remaining, choosen} = Sort /@ {
Complement[data, selected], selected}) /.
{{} :> Nothing,
x : {_?NumericQ, _?NumericQ} :>
Tooltip[x, Style[Position[data, x][[1, 1]], 20]]},
PlotRange -> All,
PlotMarkers -> {
If[remaining === {},
Style["■", Orange, 16],
Style["●", Blue]],
Style["■", Orange, 16]}],
SpanFromLeft},
{"remaining", "choosen"},
Column /@ {remaining, choosen}},
Frame -> All,
ItemSize -> 12],
{{selected, {}},