{{ objname }} distribution
{{ underline }}{{ underline }}

.. plot::
    :include-source: False

    import openturns as ot
    from matplotlib import pyplot as plt
    from openturns.viewer import View
    title = None
    if ot.{{ objname }}().__class__.__name__ == 'Bernoulli':
        distribution = ot.Bernoulli(0.7)
    elif ot.{{ objname }}().__class__.__name__ == 'Binomial':
        distribution = ot.Binomial(5, 0.2)
    elif ot.{{ objname }}().__class__.__name__ == 'Hypergeometric':
        distribution = ot.Hypergeometric(10, 4, 7)
    elif ot.{{ objname }}().__class__.__name__ == 'CumulativeDistributionNetwork':
        coll = [ot.Normal(2),ot.Dirichlet([0.5, 1.0, 1.5])]
        distribution = ot.CumulativeDistributionNetwork(coll, ot.BipartiteGraph([[0,1], [0,1]]))
    elif ot.{{ objname }}().__class__.__name__ == 'Histogram':
        distribution = ot.Histogram([-1.0, 0.5, 1.0, 2.0], [0.45, 0.4, 0.15])
    elif ot.{{ objname }}().__class__.__name__ == 'KernelMixture':
        kernel = ot.Uniform()
        sample = ot.Normal().getSample(5)
        bandwidth = [1.0]
        distribution = ot.KernelMixture(kernel, bandwidth, sample)
    elif ot.{{ objname }}().__class__.__name__ == 'MaximumDistribution':
        coll = [ot.Uniform(2.5, 3.5), ot.LogUniform(1.0, 1.2), ot.Triangular(2.0, 3.0, 4.0)]
        distribution = ot.MaximumDistribution(coll)
    elif ot.{{ objname }}().__class__.__name__ == 'Multinomial':
        distribution = ot.Multinomial(5, [0.2])
    elif ot.{{ objname }}().__class__.__name__ == 'RandomMixture':
        coll = [ot.Triangular(0.0, 1.0, 5.0), ot.Uniform(-2.0, 2.0)]
        weights = [0.8, 0.2]
        cst = 3.0
        distribution = ot.RandomMixture(coll, weights, cst)
    elif ot.{{ objname }}().__class__.__name__ == 'SmoothedUniform':
        distribution = ot.SmoothedUniform(-1.0, 10.0, 1.0)
    elif ot.{{ objname }}().__class__.__name__ == 'TruncatedDistribution':
        distribution = ot.TruncatedDistribution(ot.Normal(2.0, 1.5), 1.0, 4.0)
    elif ot.{{ objname }}().__class__.__name__ == 'UserDefined':
        distribution = ot.UserDefined([[1.0], [2.0], [3.0]], [0.4, 0.5, 1.0])
    elif ot.{{ objname }}().__class__.__name__ == 'ZipfMandelbrot':
        distribution = ot.ZipfMandelbrot(10, 2.5, 0.3)
    elif ot.{{ objname }}().__class__.__name__ == 'Normal':
        cov = ot.CovarianceMatrix([[1.0, -0.5], [-0.5, 1.0]])
        distribution = ot.Normal([0.0, 0.0], cov)
        title = "Normal dist. with correlation coefficient {}".format(cov[0, 1])
    else:
        distribution = ot.{{ objname }}()

    dimension = distribution.getDimension()
    if title is None:
        title = str(distribution)[:100].split('\n')[0]
    if dimension == 1:
        distribution.setDescription(['$x$'])
        pdf_graph = distribution.drawPDF()
        cdf_graph = distribution.drawCDF()
        fig = plt.figure(figsize=(10, 4))
        pdf_axis = fig.add_subplot(121)
        cdf_axis = fig.add_subplot(122)
        View(pdf_graph, figure=fig, axes=[pdf_axis], add_legend=False)
        View(cdf_graph, figure=fig, axes=[cdf_axis], add_legend=False)
        fig.suptitle(title)
    elif dimension == 2:
        grid = ot.GridLayout(1, 2)
        pdf_graph = distribution.drawPDF()
        pdf_contour = pdf_graph.getDrawable(0).getImplementation()
        pdf_contour.setColorBarPosition("")
        pdf_contour.setColorMapNorm("rank")
        pdf_graph.setDrawable(pdf_contour, 0)
        cdf_graph = distribution.drawCDF()
        cdf_contour = cdf_graph.getDrawable(0).getImplementation()
        cdf_contour.setColorBarPosition("")
        cdf_contour.setColorMapNorm("rank")
        cdf_graph.setDrawable(cdf_contour, 0)
        grid.setGraph(0, 0, pdf_graph)
        grid.setGraph(0, 1, cdf_graph)
        grid.setTitle(title)
        fig = View(grid).getFigure()
        fig.axes[0].set_title('PDF')
        fig.axes[1].set_title('CDF')

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
   :exclude-members: __call__, thisown

   {% block methods %}
   .. automethod:: __init__
   {% endblock %}

.. minigallery:: {{module}}.{{objname}}
   :add-heading: Examples using the class
