By my count (or illogic) there are 35 columns and 15 rows. If we assume that the points are closely (but not necessarily exactly) aligned on a grid, then there should exist for all points values $n$, $x_{min}$, $x_{max}$, and some integer $i$ such that
$$x \approx x_{min} + (x_{max}-x_{min})i/n$$
The integer value $i$ is estimated to be
Round[(n (x - xmin))/(xmax - xmax)]
$x_{min}$ and $x_{max}$ can be approximated by the min and max of the list of numbers.
Putting this altogether is the following code:
nMax = 100;
{xmin, xmax} = MinMax[pts[[All, 1]]];
t = Table[{n, Total[Abs[# - xmin - (xmax - xmin) Round[(n (# - xmin))/(xmax - xmin)]/n] &
/@ pts[[All, 1]]]}, {n, 1, nMax}];
nx = 1 + Position[t, Min[t[[All, 2]]]][[1, 1]]
(* 35 *)
nMax = 100;
{ymin, ymax} = MinMax[pts[[All, 2]]];
t = Table[{n, Total[Abs[# - ymin - (ymax - ymin) Round[(n (# - ymin))/(ymax - ymin)]/n] &
/@ pts[[All, 2]]]}, {n, 1, nMax}];
ny = 1 + Position[t, Min[t[[All, 2]]]][[1, 1]]
(* 15 *)
Here is a figure showing the grid lines:
ListPlot[pts, PlotStyle -> Blue,
GridLines -> {xmin + (xmax - xmin) Range[0, nx - 1]/(nx - 1),
ymin + (ymax - ymin) Range[0, ny - 1]/(ny - 1)}]
Note that I've set nMax
to the maximum value of the dimension that I would expect. (And this can certainly be made more robust. I've used Table
to generate a list of possible values as I couldn't get Minimize
to converge to the desired solution.)
Round
the values to get the bins you are looking for. $\endgroup$approximate
beat me.. $\endgroup$Length /@ DeleteDuplicates /@ (Round[#, 1] & /@ Transpose[pts])
yields{32, 15}
. $\endgroup$1
. Because sometimes it does not just differ 1 in the same column..Such as forpts*100
$\endgroup$