I have a scatter graph with points placed on it like:

I am trying to find an equation that gives me the density of the points on the graph, for example the points on this graph:

are closer together so it would have a higher density than something like this:

I apologize if i am not using the proper terminology or anything, i'm not very good at math..
Edit: To clarify, each point has a x/y coordinate and i do have the max x/y coordinate for the graph. The points are placed at their coordinate within the max x/y coordinates.