I propose a compromise between rounding positions and pairwise comparisons of Mr.Wizard answer
data = RandomReal[{-1, 1}, {10000, 2}];
f1[data_, r_] := First /@ GatherBy[data, Round[#, r] &];
f2[data_, r_] := f1[# - ConstantArray[{r/2.0, 0.0}, Length[#]], r] &@
f1[# - ConstantArray[{0.0, r/2.0}, Length[#]], r] &@
f1[# + ConstantArray[{r/2.0, 0.0}, Length[#]], r] &@
f1[data + ConstantArray[{0.0, r/2.0}, Length[data]], r];
f3[data_, r_] := f1[# + r/3, r] &@f1[# + r/3, r] &@f1[data, r] - 2r/3;
data1 = f1[data, 0.02];
data2 = f2[data, 0.02];
data3 = f3[data, 0.02];
f3
is simpler than f2
but produce slight anisotropy. Now minimal pairwise distances are
mindist[data_] :=
Sqrt@Min@Array[
Min@Total[(data[[#]] - Transpose@data[[1 ;; # - 1]])^2] &,
Length[data] - 1, 2];
mindist /@ {data, data1, data2, data3}
{0.000165427, 0.000540778, 0.0102496, 0.00725789}
As you can see f2
and f3
give much greater minimal distance. The lower bound of minimal distance is 0
for f1
, r/2
for f2
, and r/3
for f3
.
Visual comparison:
ListPlot[#, AspectRatio -> 1, ImageSize -> 350] & /@ {data, data1, data2, data3} // Row

AspectRatio -> Automatic
to your plot. $\endgroup$