.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/pyplots/pyplot_text.py" .. LINE NUMBERS ARE GIVEN BELOW. .. 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_pyplots_pyplot_text.py: =========== Pyplot Text =========== .. GENERATED FROM PYTHON SOURCE LINES 7-29 .. code-block:: default import numpy as np import matplotlib.pyplot as plt # Fixing random state for reproducibility np.random.seed(19680801) mu, sigma = 100, 15 x = mu + sigma * np.random.randn(10000) # the histogram of the data n, bins, patches = plt.hist(x, 50, density=True, facecolor='g', alpha=0.75) plt.xlabel('Smarts') plt.ylabel('Probability') plt.title('Histogram of IQ') plt.text(60, .025, r'$\mu=100,\ \sigma=15$') plt.xlim(40, 160) plt.ylim(0, 0.03) plt.grid(True) plt.show() .. image:: /gallery/pyplots/images/sphx_glr_pyplot_text_001.png :alt: Histogram of IQ :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 30-41 .. admonition:: References The use of the following functions, methods, classes and modules is shown in this example: - `matplotlib.pyplot.hist` - `matplotlib.pyplot.xlabel` - `matplotlib.pyplot.ylabel` - `matplotlib.pyplot.text` - `matplotlib.pyplot.grid` - `matplotlib.pyplot.show` .. _sphx_glr_download_gallery_pyplots_pyplot_text.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: pyplot_text.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: pyplot_text.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature Keywords: matplotlib code example, codex, python plot, pyplot `Gallery generated by Sphinx-Gallery `_