1
$\begingroup$

I generate some random 2D data points, then look at the histogram in three different ways.

dataf = RandomVariate[NormalDistribution[0, 1], {200, 2}];

Histogram3D[dataf, 5]

DensityHistogram[dataf, ColorFunction -> "Rainbow", ImageSize -> 400, 
 AspectRatio -> 1/GoldenRatio, ColorFunction -> "Rainbow", 
 ImageSize -> 400, AspectRatio -> 1/GoldenRatio, 
 ChartLegends -> Placed[Automatic, Right]]

SmoothDensityHistogram[dataf, ColorFunction -> "Rainbow", 
 ImageSize -> 400, AspectRatio -> 1/GoldenRatio, 
 ColorFunction -> "Rainbow", ImageSize -> 400, 
 AspectRatio -> 1/GoldenRatio, 
 PlotLegends -> 
  Placed[BarLegend[Automatic, 
    LabelStyle -> {GrayLevel[0.3], 10, FontFamily -> "Helvetica"}], 
   After]]

enter image description here

The values along the z-axis for the Histogram3D are easy enough to understand, they are the bin heights. But what are the meanings for the values in the DensityHistogram legend? I would expect it to be related to the first plot like DensityPlot is related to Plot3D. But the values are wildly different.

And the SmoothDensityHistogram is even more different.

$\endgroup$
3
  • $\begingroup$ It is totally unclear what you asking. $\endgroup$
    – m_goldberg
    Nov 5, 2015 at 14:30
  • $\begingroup$ The values for DensityHistogram and Histogram3D are the same, but you aren't using the same number of bins for both. $\endgroup$ Nov 5, 2015 at 15:11
  • 1
    $\begingroup$ "SmoothDensityHistogram[data] by default generates colorized grayscale output of the PDF of {{$x_1$, $y_1$}, ...}, based on a smooth kernel density estimate." $\endgroup$ Nov 5, 2015 at 15:12

0

Browse other questions tagged or ask your own question.