Skip to main content
4 of 4
edited tags

Gaps in the plot of a cumulative distribution function produced from HistogramDistribution

I have about 200 real numbers spread over the range 0-400. I use HistogramDistribution to bin them and PDF to create the resulting step-wise probability distribution. I assumed that CDF applied to the HistogramDistribution would yield a continuous, piece-wise linear function, but I keep getting these annoying gaps in the plot of the CDF.

Here's the code I'm using applied to some random data:

data = Table[400*RandomReal[], {200}];
pd = PDF[HistogramDistribution[data, 20]];
Plot[pd[x], {x, 0, 400}]
Plot[CDF[HistogramDistribution[data, 20], x], {x, 0, 400}]

Any idea what's causing the gaps and how to get rid of them?