Plotting a histogram of particle intensity vs pixel I am trying to reproduce a figure, shown below, of a particle intensity binned by the pixel number then fit the distribution to a Gaussian. I have a similarly magnified intensity image of my particle, with 8-bit depth, loaded into MATLAB.

I am having difficulty understanding how the bottom figure seems to retain spatial information after binning. The goal is to fit the distribution to a Gaussian.
The expected distribution of intensity versus x,y position is formed by two idependent and identically distributed gaussian random variables; one for each axis. The distribution shown is for one "slice" through this 2D distribution.  The top view of the distribution can be envisioned as a 3d Gaussian "hill", and the histogram shown is for one slice through this hill as viewed from the side, where the slice can be from any direction as long as it goes through the center (origin).