%feature("docstring") OT::VisualTest::DrawHenryLine
"Draw an Henry plot.

Parameters
----------
sample : 2-d sequence of float
    Tested (univariate) sample.
normal_distribution : :class:`~openturns.Normal`, optional
    Tested (univariate) normal distribution.

    If not given, this will build a :class:`~openturns.Normal` distribution
    from the given sample using the :class:`~openturns.NormalFactory`.

Returns
-------
graph : class:`~openturns.Graph`
    The graph object

Notes
-----
The Henry plot is a visual fitting test for the normal distribution. It
opposes the sample quantiles to those of the standard normal distribution
(the one with zero mean and unit variance) by plotting the following points
could:

.. math::

    \left(x^{(i)},
          \Phi^{-1}\left(\widehat{F}\left(x^{(i)}\right)\right)
    \right), \quad i = 1, \ldots, m

where :math:`\widehat{F}` denotes the empirical CDF of the sample and
:math:`\Phi^{-1}` denotes the quantile function of the standard normal
distribution.

If the given sample fits to the tested normal distribution (with mean
:math:`\mu` and standard deviation :math:`\sigma`), then the points should be
close to be aligned (up to the uncertainty associated with the estimation
of the empirical probabilities) on the **Henry line** whose equation reads:

.. math::

    y = \frac{x - \mu}{\sigma}, \quad x \in \Rset

The Henry plot is a special case of the more general QQ-plot.

See Also
--------
VisualTest_DrawQQplot, FittingTest_Kolmogorov

Examples
--------
>>> import openturns as ot
>>> from openturns.viewer import View

Generate a random sample from a Normal distribution:

>>> ot.RandomGenerator.SetSeed(0)
>>> distribution = ot.Normal(2.0, 0.5)
>>> sample = distribution.getSample(30)

Draw an Henry plot against a given (wrong) Normal distribution:

>>> henry_graph = ot.VisualTest.DrawHenryLine(sample, distribution)
>>> henry_graph.setTitle('Henry plot against given %s' % ot.Normal(3.0, 1.0))
>>> View(henry_graph).show()

Draw an Henry plot against an inferred Normal distribution:

>>> henry_graph = ot.VisualTest.DrawHenryLine(sample)
>>> henry_graph.setTitle('Henry plot against inferred Normal distribution')
>>> View(henry_graph).show()"

// ---------------------------------------------------------------------

%feature("docstring") OT::VisualTest::DrawQQplot
"Draw a QQ-plot.

Available usages:
    VisualTest.DrawQQplot(*sample1, sample2, n_points*)

    VisualTest.DrawQQplot(*sample1, distribution*);

Parameters
----------
sample1, sample2 : 2-d sequences of float
    Tested samples.
ditribution : :class:`~openturns.Distribution`
    Tested model.
n_points : int, optional
    The number of points that is used for interpolating the empirical CDF of
    the two samples (with possibly different sizes).

    It will default to *DistributionImplementation-DefaultPointNumber* from
    the :class:`~openturns.ResourceMap`.

Returns
-------
graph : class:`~openturns.Graph`
    The graph object

Notes
-----
The QQ-plot is a visual fitting test for univariate distributions. It
opposes the sample quantiles to those of the tested quantity (either a
distribution or another sample) by plotting the following points cloud:

.. math::

    \left(x^{(i)},
          \theta\left(\widehat{F}\left(x^{(i)}\right)\right)
    \right), \quad i = 1, \ldots, m

where :math:`\widehat{F}` denotes the empirical CDF of the (first) tested
sample and :math:`\theta` denotes either the quantile function of the tested
distribution or the empirical quantile function of the second tested sample.

If the given sample fits to the tested distribution or sample, then the points
should be close to be aligned (up to the uncertainty associated with the
estimation of the empirical probabilities) with the **first bissector**  whose
equation reads:

.. math::

    y = x, \quad x \in \Rset

Examples
--------
>>> import openturns as ot
>>> from openturns.viewer import View

Generate a random sample from a Normal distribution:

>>> ot.RandomGenerator.SetSeed(0)
>>> distribution = ot.Weibull(2.0, 0.5)
>>> sample = distribution.getSample(30)
>>> sample.setDescription(['Sample'])

Draw a QQ-plot against a given (inferred) distribution:

>>> tested_distribution = ot.WeibullFactory().build(sample)
>>> QQ_plot = ot.VisualTest.DrawQQplot(sample, tested_distribution)
>>> View(QQ_plot).show()

Draw a two-sample QQ-plot:

>>> another_sample = distribution.getSample(50)
>>> another_sample.setDescription(['Another sample'])
>>> QQ_plot = ot.VisualTest.DrawQQplot(sample, another_sample)
>>> View(QQ_plot).show()"

// ---------------------------------------------------------------------

%feature("docstring") OT::VisualTest::DrawCobWeb
"Draw a Cobweb plot.

Available usages:
    VisualTest.DrawCobWeb(*inputSample, outputSample, min, max, color, quantileScale=True*)

Parameters
----------
inputSample : 2-d sequence of float of dimension :math:`n`
    Input sample :math:`\vect{X}`.
outputSample : 2-d sequence of float of dimension :math:`1`
    Output sample :math:`Y`.
Ymin, Ymax : float such that *Ymax > Ymin*
    Values to select lines which will colore in *color*. Must be in
    :math:`[0,1]` if *quantileScale=True*.
color : str
    Color of the specified curves.
quantileScale : bool
    Flag indicating the scale of the *Ymin* and *Ymax*. If
    *quantileScale=True*, they are expressed in the rank based scale;
    otherwise, they are expressed in the :math:`Y`-values scale.

Returns
-------
graph : class:`~openturns.Graph`
    The graph object

Notes
-----
Let's suppose a model :math:`f: \Rset^n \mapsto \Rset`, where
:math:`f(\vect{X})=Y`.
The Cobweb graph enables to visualize all the combinations of the input
variables which lead to a specific range of the output variable.

Each column represents one component :math:`X_i` of the input vector
:math:`\vect{X}`. The last column represents the scalar output variable
:math:`Y`.

For each point :math:`\vect{X}^j` of *inputSample*, each component :math:`X_i^j`
is noted on its respective axe and the last mark is the one which corresponds
to the associated :math:`Y^j`. A line joins all the marks. Thus, each point of
the sample corresponds to a particular line on the graph.

The scale of the axes are quantile based : each axe runs between 0 and 1 and
each value is represented by its quantile with respect to its marginal
empirical distribution.

It is interesting to select, among those lines, the ones which correspond to a
specific range of the output variable. These particular lines selected are
colored differently in *color*. This specific range is defined with *Ymin* and
*Ymax* in the quantile based scale of :math:`Y` or in its specific scale. In
that second case, the range is automatically converted into a quantile based
scale range.

Examples
--------
>>> import openturns as ot
>>> from openturns.viewer import View

Generate a random sample from a Normal distribution:

>>> ot.RandomGenerator.SetSeed(0)
>>> inputSample = ot.Normal(2).getSample(15)
>>> inputSample.setDescription(['X0', 'X1'])
>>> formula = ['cos(X0)+cos(2*X1)']
>>> model = ot.SymbolicFunction(['X0', 'X1'], formula)
>>> outputSample = model(inputSample)

Draw a Cobweb plot:

>>> cobweb = ot.VisualTest.DrawCobWeb(inputSample, outputSample, 1.0, 2.0, 'red', False)
>>> View(cobweb).show()"

// ---------------------------------------------------------------------

%feature("docstring") OT::VisualTest::DrawHistogram
"Draw an histogram.

Available usages:
    VisualTest.DrawHistogram(*sample*)

    VisualTest.DrawHistogram(*sample, barsNumber*)

Parameters
----------
sample : 2-d sequence of float
    Sample to draw.
barsNumber : positive int
    Number of barplots used to draw the histogram. If not specified, it is
    automatically determined by OpenTURNS according to the Silverman rule.

Returns
-------
graph : class:`~openturns.Graph`
    The graph object

Examples
--------
>>> import openturns as ot
>>> from openturns.viewer import View

Generate a random sample from a Normal distribution:

>>> ot.RandomGenerator.SetSeed(0)
>>> sample = ot.Normal(1).getSample(100)

Draw an histogram:

>>> hist = ot.VisualTest.DrawHistogram(sample)
>>> View(hist).show()"

// ---------------------------------------------------------------------

%feature("docstring") OT::VisualTest::DrawEmpiricalCDF
"Draw an empirical CDF.

Available usages:
    VisualTest.DrawEmpiricalCDF(*sample*)
    VisualTest.DrawEmpiricalCDF(*sample, Xmin, Xmax*)

Parameters
----------
sample : 2-d sequence of float
    Sample to draw.
Xmin, Xmax : float with *Xmin < Xmax*
    Lower and upper boundaries of the graph.

Returns
-------
graph : class:`~openturns.Graph`
    The graph object

Notes
-----
The created graph contains a staircase curve which is the empirical CDF of the
sample.

Examples
--------
>>> import openturns as ot
>>> from openturns.viewer import View

Generate a random sample from a Normal distribution:

>>> ot.RandomGenerator.SetSeed(0)
>>> sample = ot.Normal(1).getSample(100)

Draw an empirical CDF:

>>> empiricalCDF = ot.VisualTest.DrawEmpiricalCDF(sample)
>>> View(empiricalCDF).show()"

// ---------------------------------------------------------------------

%feature("docstring") OT::VisualTest::DrawClouds
"Draw clouds from samples.

Available usages:
    VisualTest.DrawClouds(*sample, distribution*)

    VisualTest.DrawClouds(*sample, sample2*)

Parameters
----------
sample, sample2 : 2-d sequence of float
    Samples to draw.
distribution : :class:`~openturns.Distribution`
    Distribution used to plot the second cloud

Returns
-------
graph : class:`~openturns.Graph`
    The graph object

Examples
--------
>>> import openturns as ot
>>> from openturns.viewer import View
>>> ot.RandomGenerator.SetSeed(0)
>>> sample1 = ot.Normal(2).getSample(50)
>>> sample2 = ot.Normal(2).getSample(50)
>>> clouds = ot.VisualTest.DrawClouds(sample1, sample2)
>>> View(clouds).show()"

// ---------------------------------------------------------------------

%feature("docstring") OT::VisualTest::DrawKendallPlot
"Draw kendall plot.

Available usages:
    VisualTest.DrawKendallPlot(*sample, distribution*)

    VisualTest.DrawKendallPlot(*sample, sample2*)

Parameters
----------
sample, sample2 : 2-d sequence of float
    Samples to draw.
distribution : :class:`~openturns.Distribution`
    Distribution used to plot the second cloud

Returns
-------
graph : class:`~openturns.Graph`
    The graph object

Examples
--------
>>> import openturns as ot
>>> from openturns.viewer import View
>>> ot.RandomGenerator.SetSeed(0)
>>> size = 100
>>> copula1 = ot.FrankCopula(1.5)
>>> copula2 = ot.GumbelCopula(4.5)
>>> sample1 = copula1.getSample(size)
>>> sample1.setName('data 1')
>>> sample2 = copula2.getSample(size)
>>> sample2.setName('data 2')
>>> kendallPlot1 = ot.VisualTest.DrawKendallPlot(sample1, copula2)
>>> View(kendallPlot1).show()"

// ---------------------------------------------------------------------

%feature("docstring") OT::VisualTest::DrawLinearModel
"Draw a linear model plot.

Parameters
----------
sample1, sample2 : 2-d sequence of float
    Samples to draw.
linearModel : :class:`~openturns.LinearModel`
    Linear model to plot.

Returns
-------
graph : class:`~openturns.Graph`
    The graph object

Examples
--------
>>> import openturns as ot
>>> from openturns.viewer import View
>>> ot.RandomGenerator.SetSeed(0)
>>> dimension = 2
>>> R = ot.CorrelationMatrix(dimension)
>>> R[0, 1] = 0.8
>>> distribution = ot.Normal([3.0] * dimension, [2.0]* dimension, R)
>>> size = 100
>>> sample2D = distribution.getSample(size)
>>> firstSample = ot.Sample(size, 1)
>>> secondSample = ot.Sample(size, 1)
>>> for i in range(size):
...     firstSample[i] = ot.Point(1, sample2D[i, 0])
...     secondSample[i] = ot.Point(1, sample2D[i, 1])
>>> lmtest = ot.LinearModelFactory().build(firstSample, secondSample)
>>> drawLinearModelVTest = ot.VisualTest.DrawLinearModel(firstSample, secondSample, lmtest)
>>> View(drawLinearModelVTest).show()"

// ---------------------------------------------------------------------

%feature("docstring") OT::VisualTest::DrawLinearModelResidual
"Draw a linear model residual plot.

Parameters
----------
sample1, sample2 : 2-d sequence of float
    Samples to draw.
linearModel : :class:`~openturns.LinearModel`
    Linear model to plot.

Returns
-------
graph : class:`~openturns.Graph`
    The graph object

Examples
--------
>>> import openturns as ot
>>> from openturns.viewer import View
>>> ot.RandomGenerator.SetSeed(0)
>>> dimension = 2
>>> R = ot.CorrelationMatrix(dimension)
>>> R[0, 1] = 0.8
>>> distribution = ot.Normal([3.0] * dimension, [2.0]* dimension, R)
>>> size = 100
>>> sample2D = distribution.getSample(size)
>>> firstSample = ot.Sample(size, 1)
>>> secondSample = ot.Sample(size, 1)
>>> for i in range(size):
...     firstSample[i] = ot.Point(1, sample2D[i, 0])
...     secondSample[i] = ot.Point(1, sample2D[i, 1])
>>> lmtest = ot.LinearModelFactory().build(firstSample, secondSample)
>>> drawLinearModelVTest = ot.VisualTest.DrawLinearModelResidual(firstSample, secondSample, lmtest)
>>> View(drawLinearModelVTest).show()"
