HISTOGRAM_DISCRETE is a MATLAB program which creates a histogram of discrete data.
The motivation of this study was to explore whether a histogram could be made without artificially imposing bins; instead, the original data would be kept and handled directly.
An attempt was made to come up with a sensible formulation of the probability density function (PDF) for data in the range [X_MIN,X_MAX]. Instead of what amounts to a Dirac delta function, or a discrete bin function, a piecewise linear function was devised that tried to emulate the distribution of probability density along the interval. A corresponding piecewise quadratic cumulative density function (CDF) was also constructed.
Because we don't use bins, we can plot the PDF and CDF at any resolution we like. When we do so, the CDF looks reasonable, but the PDF does not look so good; a particularly unpleasant example occurs for the Gaussian test. Now we see that binning has the advantage of smoothing out the PDF data, whereas our piecewise linear function is too jumpy. Presumably, one way to cure this would allow us to retain the piecewise linear PDF, while essentially binning the data dynamically, according to the resolution of the requested plot. This, of course, is work to be pursued in the vague future.
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
HISTOGRAM_DISCRETE is available in a MATLAB version.
HISTOGRAM_DISPLAY, a MATLAB program which makes a bar plot of a set of data stored as columns in a file; the first column is the X values, and all the other columns are Y values to be shown as a stack of bars;
PWC_PLOT, a MATLAB library which converts the definition of a piecewise constant function into plottable data.
You can go up one level to the MATLAB source codes.