
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/pyplots/pyplot_mathtext.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        Click :ref:`here <sphx_glr_download_gallery_pyplots_pyplot_mathtext.py>`
        to download the full example code

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_pyplots_pyplot_mathtext.py:


===============
Pyplot Mathtext
===============

Use mathematical expressions in text labels. For an overview over MathText
see :doc:`/tutorials/text/mathtext`.

.. GENERATED FROM PYTHON SOURCE LINES 9-23

.. code-block:: default

    import numpy as np
    import matplotlib.pyplot as plt
    t = np.arange(0.0, 2.0, 0.01)
    s = np.sin(2*np.pi*t)

    plt.plot(t, s)
    plt.title(r'$\alpha_i > \beta_i$', fontsize=20)
    plt.text(1, -0.6, r'$\sum_{i=0}^\infty x_i$', fontsize=20)
    plt.text(0.6, 0.6, r'$\mathcal{A}\mathrm{sin}(2 \omega t)$',
             fontsize=20)
    plt.xlabel('time (s)')
    plt.ylabel('volts (mV)')
    plt.show()




.. image-sg:: /gallery/pyplots/images/sphx_glr_pyplot_mathtext_001.png
   :alt: $\alpha_i > \beta_i$
   :srcset: /gallery/pyplots/images/sphx_glr_pyplot_mathtext_001.png, /gallery/pyplots/images/sphx_glr_pyplot_mathtext_001_2_0x.png 2.0x
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 24-30

.. admonition:: References

   The use of the following functions, methods, classes and modules is shown
   in this example:

   - `matplotlib.axes.Axes.text` / `matplotlib.pyplot.text`


.. _sphx_glr_download_gallery_pyplots_pyplot_mathtext.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_mathtext.py <pyplot_mathtext.py>`



  .. container:: sphx-glr-download sphx-glr-download-jupyter

     :download:`Download Jupyter notebook: pyplot_mathtext.ipynb <pyplot_mathtext.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    Keywords: matplotlib code example, codex, python plot, pyplot
    `Gallery generated by Sphinx-Gallery
    <https://sphinx-gallery.readthedocs.io>`_
