This can easily be done with a "frequency plot". If the frequency option is set "all points with the same x-value are replaced by a single point having the summed y-values" (help smooth frequency). This means if you assign to every point the y-value 1 the result will be the number of all points having a particular x-value.
Now, in order to be able to sum up all points within a certain range you can use a function which rounds off the values of the data as suggested here
bin(x)=0.1*floor(x/0.1)
plot "datafile.txt" using (bin($1)):(1.0) smooth frequency with boxes
You might also want to tweak the appearance of the boxes with set boxwidth
and set style fill
.