.. only:: html
.. note::
:class: sphx-glr-download-link-note
Click :ref:`here ` to download the full example code
.. rst-class:: sphx-glr-example-title
.. _sphx_glr_auto_probabilistic_modeling_distributions_plot_gaussian_distribution.py:
Create a gaussian distribution
==============================
In this example we are going to create a gaussian distribution with parameters
.. math::
\mu = 2.2, \sigma = 0.6
.. code-block:: default
from __future__ import print_function
import openturns as ot
import openturns.viewer as viewer
from matplotlib import pylab as plt
ot.Log.Show(ot.Log.NONE)
distribution = ot.Normal(2.2, 0.6)
print(distribution)
.. rst-class:: sphx-glr-script-out
Out:
.. code-block:: none
Normal(mu = 2.2, sigma = 0.6)
.. code-block:: default
sample = distribution.getSample(10)
print(sample)
.. rst-class:: sphx-glr-script-out
Out:
.. code-block:: none
[ X0 ]
0 : [ 3.52252 ]
1 : [ 1.98154 ]
2 : [ 2.71262 ]
3 : [ 2.23047 ]
4 : [ 2.95334 ]
5 : [ 2.25199 ]
6 : [ 2.53609 ]
7 : [ 2.3081 ]
8 : [ 1.71475 ]
9 : [ 2.47636 ]
.. code-block:: default
graph = distribution.drawPDF()
view = viewer.View(graph)
plt.show()
.. image:: /auto_probabilistic_modeling/distributions/images/sphx_glr_plot_gaussian_distribution_001.png
:alt: plot gaussian distribution
:class: sphx-glr-single-img
.. rst-class:: sphx-glr-timing
**Total running time of the script:** ( 0 minutes 0.069 seconds)
.. _sphx_glr_download_auto_probabilistic_modeling_distributions_plot_gaussian_distribution.py:
.. only :: html
.. container:: sphx-glr-footer
:class: sphx-glr-footer-example
.. container:: sphx-glr-download sphx-glr-download-python
:download:`Download Python source code: plot_gaussian_distribution.py `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: plot_gaussian_distribution.ipynb `
.. only:: html
.. rst-class:: sphx-glr-signature
`Gallery generated by Sphinx-Gallery `_