Gnuplot 3d binning

Hello

I have a text file with tens of thousands of rows
The format is
x y

where both x and y can be anything between -100 and +100.

What I would like to do is have a 3d gnuplot where there are 10,000 squared or bins and each bin will count how many rows have a value that would be assigned to that bin.

So if a row is -50, -50
and then next row is again -50, -50

then the value for that bin would be 2

anybody got any idea how to make script in bash to do this??

I need to count the number of rows with x value between -100 and -99 and y value between -100 and -99....
then count the number of rows with x value between -100 and -99 and y value between -99 and -98

etc

and then is should have a 3 column text file which I cna display in gnuplot.

Are the values fractional nn.nnnnnn, so they need to be truncated to int before counting? I assume they are in text, being space and line separated. Examples are nice. Still, with x and y ranges of 201 integers, that is 40K+ pairs. You can run it through sed to remove the fractions and then sort and uniq to count.

sed 's/\.[0-9]*//g' in_file|sort|uniq -c > out_file

f course, values like '.123456' will disappear, so I hope they are '0.123456', else sed needs to force the zero.