.. 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_data_analysis_sample_analysis_plot_visualize_histogram.py:
Draw an histogram
=================
In this example we are going to a plot an histogram from an unidimensional sample.
.. 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)
Create data to visualize
.. code-block:: default
size = 500
normal = ot.Normal(1)
sample = normal.getSample(size)
Draw histogram
.. code-block:: default
graph = ot.HistogramFactory().build(sample).drawPDF()
view = viewer.View(graph)
plt.show()
.. image:: /auto_data_analysis/sample_analysis/images/sphx_glr_plot_visualize_histogram_001.png
:alt: X0 PDF
:class: sphx-glr-single-img
.. rst-class:: sphx-glr-timing
**Total running time of the script:** ( 0 minutes 0.075 seconds)
.. _sphx_glr_download_auto_data_analysis_sample_analysis_plot_visualize_histogram.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_visualize_histogram.py `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: plot_visualize_histogram.ipynb `
.. only:: html
.. rst-class:: sphx-glr-signature
`Gallery generated by Sphinx-Gallery `_