I create a scatter plot of data points of ~ 300 KB, and I have a problem that it is so crowded in some places that no structure is visible - so I had a thought!
I want the graph to create a contour graph for the densest parts and leave less dense areas with scatter() data points.
So, I tried to individually calculate the nearest neighbor distance for each of the data points, and then when this distance has reached a certain value, draw a contour and fill it, and then when it reaches a much larger value (less dense) just make a spread ...
I tried and failed for several days, I'm not sure if the conditional contour graph will work in this case.
I would put the code, but it is so dirty and probably just confuse the problem. And it is so computationally intensive that maybe it just ruins my computer if it works!
Thank you all in advance!
ps I searched and searched for an answer! I am convinced that this is impossible even for all the results that he received!
Edit: Thus, the idea is to see where some specific points lie in the structure of the 300k sample. Here is an example plot, my points are scattered in three different ways. colors. 
I will try to randomly try 1000 data from my data and load it as a text file. Cheers Stackers. :)
Edit: Hey, here are a few examples of the data in 1000 rows - just two columns [X,Y] (or [gi,i] from the graph above) space. Thank you all! data
source share