# Extracting the data from DensityHistogram

I have a plot of a DensityHistogram from a dataset collected in the lab (stored as {{x1,y1},{x2,y2},...}). The data used to construct the histogram is convolved with the impulse response of the detector in the measurement, and I want to deconvolve the data. Is there a way to extract the underlying data from DensityHistogram as a matrix/list of lists so that I can deconvolve it with ListDeconvolve?

Here is an example with a list of random numbers (I chose about 30% of the size of the dataset I am using to make everything a bit quicker). I am not doing any post-processing and the underlying structure of my data is NOT random, but I think this would be enough to generate a similar sort of plot.

data = RandomVariate[BinormalDistribution[{1000, 1000}, {100, 1000}, 0], 10000];
DensityHistogram[data, {100}, PlotRange -> All, ColorFunction -> "Rainbow"]

• I am not sure what MWE stands for. Apr 18, 2020 at 1:31
• Yeah I'll do one now. Apr 18, 2020 at 1:34
• Updated question to include my example. Apr 18, 2020 at 1:54

HistogramList[data, ...] will give you a result of the form

{
{
{x1, x2, ..., xM},
{y1, y2, ..., yN}
},
{
{c11, c12, ..., c1N},
...
{cM1, cM2, ..., cMN}
}
}


where the xi are the boundaries in the x direction, the yi are the dividers in the y direction, and the cij are the counts of elements in the corresponding bins.

• (This doesn't help if you only have the plot, but I don't want people thinking this is the only way to get the counts, even when they have the original data.) Apr 18, 2020 at 3:21
• How does this differ from something like BinCounts? Obviously there are more options for how you bin the data using HistogramList, and what is returned is different, but if we are considering only the counts section, what is different? Apr 18, 2020 at 17:18
• I've noticed now that BinCounts returns just the c_ij portion that HistogramList returns Apr 18, 2020 at 21:54