I have a SmoothDensityPlot[] of a set of about 10^5 x,y points (data21fps) like this

 PlotRange -> {{0, 200}, {0, 200}}]

Time differences

I would like to get a the density value of each point of the plot. I have seen this post Obtain data points from a density plot but I have been testing Reap[] and Sow[] but the Graphics object is different and I do not know how to get the values of the plot.

Thank you very much for the help


Testing the comments to this question I have tested my dataset

D = SmoothKernelDistribution[data21fps]
DensityPlot[PDF[D, {x, y}], {x, 0, 200}, {y, 0, 200}, 
 ColorFunction -> "SunsetColors"]

obtaining the following plot

New figure

However, the graduation is different than in the original SmoothDensityHistogram[]. I have tried options of SmoothKernelDistribution like ÌnterpolationPoints,MaxRecursion, andPerformanceGoalbut the results still are different of the originalSmoothDensityPlot`.

  • 2
    $\begingroup$ Please have a look at the documentation, specifically in the section "Properties and relations". There you will find an example that shows how SmoothDensityPlot is nothing but DensityPlot applied to SmoothKernelDistribution. i.e., if you want the data, use SmoothKernelDistribution. $\endgroup$ – C. E. Sep 8 '17 at 18:26
  • $\begingroup$ @C.E. Thank you, that is what I need it. Can I ask you how to get the absolute values for each point instead of the kernel density estimation? $\endgroup$ – user1993416 Sep 8 '17 at 19:07
  • $\begingroup$ If d is what SmoothKernelDistribution returns, then you can use either PDF[d, {x, y}] for the probability density, or CDF[d, {x,y}] for the cumulative distribution value at {x,y}. The value using PDF is what SmoothDensityPlot shows you. $\endgroup$ – C. E. Sep 8 '17 at 20:14
  • $\begingroup$ @C.E. I have edited the post with the plot using SmoothKernelDistribution[] but the result is not the same $\endgroup$ – user1993416 Sep 8 '17 at 23:02
  • 1
    $\begingroup$ @user1993416 You can specify the bandwidth selection method and the kernel. They are listed in the documentation under "Details and Options" – so try that and see if you can figure out what settings SmoothDensityPlot uses. $\endgroup$ – C. E. Sep 8 '17 at 23:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.