Visualize empirical CDFΒΆ

In this example we are going to draw the empirical CDF of an unidimensional sample.

from __future__ import print_function
import openturns as ot

Then create a sample from a gaussian distribution.

size = 100
normal = ot.Normal(1)
sample = normal.getSample(size)

We draw the empirical CDF based on the UserDefined distribution. By default, the drawCDF method requires no input argument.

distribution = ot.UserDefined(sample)

If required, we can specify the interval that we want to draw. In the following example, these bounds are computed from the minimum and the maximum of the sample.

xmin = sample.getMin()[0] - 2.0
xmax = sample.getMax()[0] + 2.0
ot.UserDefined(sample).drawCDF(xmin, xmax)