.. 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_gallery_frontpage_histogram.py:
===========================
Frontpage histogram example
===========================
This example reproduces the frontpage histogram example.
.. image:: /gallery/frontpage/images/sphx_glr_histogram_001.png
:class: sphx-glr-single-img
.. code-block:: default
import matplotlib.pyplot as plt
import numpy as np
random_state = np.random.RandomState(19680801)
X = random_state.randn(10000)
fig, ax = plt.subplots()
ax.hist(X, bins=25, density=True)
x = np.linspace(-5, 5, 1000)
ax.plot(x, 1 / np.sqrt(2*np.pi) * np.exp(-(x**2)/2), linewidth=4)
ax.set_xticks([])
ax.set_yticks([])
fig.savefig("histogram_frontpage.png", dpi=25) # results in 160x120 px image
.. _sphx_glr_download_gallery_frontpage_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: histogram.py `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: histogram.ipynb `
.. only:: html
.. rst-class:: sphx-glr-signature
Keywords: matplotlib code example, codex, python plot, pyplot
`Gallery generated by Sphinx-Gallery
`_