3
$\begingroup$

I'm currently plotting 3 different tables. E.g.:

P1 = ListPlot[{Table1, Table2, Table3}, PlotStyle -> {Brown, Green, Black}}]

I need to identify those points of one table which fall within the region of another table and separate them from the rest of the data. Is there a way to select the ones I want from the plot and trace them back to whichever rows in their corresponding tables they belong to?

I have tried changing each plot marker to a number corresponding to each pair of coordinates (i.e. Table1[[3]] would have a plot marker '3', Table1[[57]] would have a plot marker '57', etc...), but so far I've been unsuccessful.

In reply to Lotus, here's an example of one of the plots:

Plot of 4 Tables (each one represented by a different colour).

Some overlap between the black and brown, as well as slight overlap between black and green. Seeing as there's no overlap with orange, I removed it from my original question, as I don't need that data. What I want to do is identify those points that do overlap with points from the other tables (or which are very close together)

$\endgroup$
2
  • 3
    $\begingroup$ Can you give us a small example ? From your question it is difficult to decipher exactly what you want. $\endgroup$
    – Lotus
    Aug 27, 2018 at 6:27
  • $\begingroup$ How about personalising the PlotMarkers so that {x1,y1} has a marker '1', {x2,y2} has a marker '2', and so on... Is this possible? $\endgroup$
    – LNah
    Aug 30, 2018 at 4:12

2 Answers 2

3
$\begingroup$

You can use BubbleChart with PieChart markers where colors represent the table a data point belongs to and the labels show the positions of the point in respective tables:

SeedRandom[77]
tables = {Table1, Table2, Table3} = DeleteDuplicates /@ RandomInteger[9, {3, 20, 2}];
data = {Append[#, 1], Flatten[Function[t, Position[t, #] /. {} -> {{0}}] /@ tables]} & /@ 
  (Union @@ tables);

Legended[BubbleChart[data[[All, 1]], BubbleSizes -> {.1, .1}, 
  ChartElements -> (PieChart[Unitize[#], ChartStyle -> "Pastel", 
       ChartLabels -> Placed[#, {.5, 0}]] & /@ data[[All, 2]])] , 
 SwatchLegend[ColorData["Pastel"] /@ {0, 1/2, 1}, {"Table1", "Table2", "Table3"}]]

enter image description here

$\endgroup$
1
  • $\begingroup$ Very ingenious solution. Unfortunately it doesn't work for me because points do not have an exact match. I should have made it clearer, but that's why I mentioned that I want to identify those points from one table that fall within the region of another table. I'm thinking that I would probably need to set some boundary limits to avoid subjectivity... $\endgroup$
    – LNah
    Aug 28, 2018 at 2:02
0
$\begingroup$

Found a way to identify points by plotting each one as a number corresponding to its position in the table ({x1,y1} will appear as a '1', {x2,y2} will appear as a '2', and so on...}, with each table being assigned a different colour:

Show[Graphics[{Green,MapIndexed[Text[First@#2,#1] &,Table1], Black,MapIndexed[Text[First@#2,#1] &,Table2]}]

This will allow to see which points from each table are close together and to easily identify each one.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.