I have 2d points and want to show a colored density plot of them. Also I want to display a legend showing which color corespons to which total number of points in a certain predefined area.
Let’s take the following 2d points:
SeedRandom[1]; points = Transpose[{RandomReal[2, 100], RandomReal[3, 100]}]; ListPlot[points, Frame -> True, PlotRange -> Full, AspectRatio -> Automatic]
I tried to use SmoothDensityHistogram
:
SmoothDensityHistogram[points, 0.1, "PDF", ColorFunction -> "Rainbow", PlotLegends -> Automatic, PlotRange -> Full, AspectRatio -> Automatic]
The density plot looks correct, but I would like to see a color legend labeled with the number of points and not with a probabliliy.
What would be the Mathematike-like solution, which is e.g using for the sliding window DiskMatrix
or somehow different producing the desired result.