Note that there are some explanatory texts on larger screens.

plurals
  1. POClustering 2D plot in Mathematica
    primarykey
    data
    text
    <pre><code>laListe={{{{10, 17}, 1}, {{33, 12}, 1}, {{32, 17}, 1}, {{9, 10},1}, {{22, 24}, 1},{{27, 6}, 2}, {{25, 13}, 2}, {{30, 9}, 2}}, {{{14, 12}, 1},{{19, 17}, 1}, {{7, 21}, 1}, {{7, 24},1}, {{27, 19}, 1}, {{12, 16}, 2}, {{13, 20}, 2}, {{20, 22}, 2}}} FrameXYs = {{4.32, 3.23}, {35.68, 26.75}} Row[Function[compNo, Graphics[{White, EdgeForm[Thick], Rectangle @@ FrameXYs, Black, Disk[Sequence @@ laListe[[compNo, #]]] &amp; /@ Range[Length@laListe[[compNo]]]}, ImageSize -&gt; 300]] /@ {1, 2}] </code></pre> <p><img src="https://i.stack.imgur.com/aimde.png" alt="enter image description here"></p> <p>I would like to find a way to cluster those disk given their proximity to each other. Does Mathematica have built in feature to do such thing ?</p> <p><strong>EDIT</strong> </p> <p>As I tried FindClusters I yet encounter several inconvenience :</p> <p>With :</p> <pre><code>list1={{{24.413, 6.5978}, {7.68887, 7.2147}, {29.357, 13.2822}, {6.22436, 9.7145}, {22.7162, 17.7198}, {13.6851, 5.7635}, {18.8062, 12.9946}, {8.04889, 16.7414}}} </code></pre> <p>Does FindClusters dislkike Decimals :</p> <pre><code>FindClusters[Flatten[list1,1]] </code></pre> <p>Out :</p> <pre><code> {{{{24.413, 6.5978}, {7.68887, 7.2147}, {29.357, 13.2822}, {6.22436,9.7145}, {22.7162, 17.7198}, {13.6851, 5.7635}, {18.8062,12.9946}, {8.04889, 16.7414}}}} </code></pre> <p>Whereas : </p> <pre><code> FindClusters[Flatten[Round[list1], 1]] </code></pre> <p>Out : </p> <pre><code> {{{24, 7}, {29, 13}, {23, 18}, {14, 6}, {19, 13}}, {{8, 7}, {6, 10}, {8, 17}}} </code></pre> <p>Then, to do this I had to get rid of the Disks Diameter which is important to me as visual cluster. Then I would like to capture alignment. When 5 disks are not grouped but aligned. And as I tested it on a few composition it does not find those as such.</p> <p>On thing I am trying is tho "Pointize" the disks using the following :</p> <pre><code>pointize[{{x_,y_},r_},size_:12] := Table[{x+r Cos[i ((2\[Pi])/size)], y+r Sin[i ((2\[Pi])/size)]},{i,0,size}] </code></pre> <p>I used that initially to compute ConvexHullArea of those disks. I feel it could help my need of taking into accound the radius, but the implementation is tricky and I am not even sure if it is relevant</p> <p>Also, I hope it was only the decimals issue, but I could not use FindClusters[list] as such but had to give it the number of cluster I want FindClusters[list,3], whereas what I want is to have the same algorithm that can find different cluster number on different composition. </p> <p>Would you think of particular settings &amp;/or distance function to do so with FindClusters?</p> <p><strong>EDIT</strong></p> <p>I found something interesting thanks to previous tricks learned thanks to experts here. Just an idea, I need to fin a way quantify that and put the new image in a matrix form or so to use .</p> <pre><code>comp1 = Graphics[{White, Rectangle @@ FrameXYs, Black, Disk[Sequence @@ laListe[[1, #]]] &amp; /@ Range[Length@laListe[[1]]]}, ImageSize -&gt; 300] </code></pre> <p><img src="https://i.stack.imgur.com/NhKBl.png" alt="enter image description here"></p> <pre><code> Binarize[ImageCorrelate[comp1, GaussianMatrix[40]], .95] </code></pre> <p><img src="https://i.stack.imgur.com/j5vmJ.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload