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

.. only:: html

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

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

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

.. _sphx_glr_gallery_userdemo_pgf_fonts.py:


=========
Pgf Fonts
=========

.. GENERATED FROM PYTHON SOURCE LINES 7-31



.. image-sg:: /gallery/userdemo/images/sphx_glr_pgf_fonts_001.png
   :alt: pgf fonts
   :srcset: /gallery/userdemo/images/sphx_glr_pgf_fonts_001.png, /gallery/userdemo/images/sphx_glr_pgf_fonts_001_2_0x.png 2.0x
   :class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

 Out:

 .. code-block:: none

    findfont: Font family ['serif'] not found. Falling back to DejaVu Sans.
    findfont: Generic family 'serif' not found because none of the following families were found: 






|

.. code-block:: default


    import matplotlib.pyplot as plt
    plt.rcParams.update({
        "font.family": "serif",
        # Use LaTeX default serif font.
        "font.serif": [],
        # Use specific cursive fonts.
        "font.cursive": ["Comic Neue", "Comic Sans MS"],
    })

    fig, ax = plt.subplots(figsize=(4.5, 2.5))

    ax.plot(range(5))

    ax.text(0.5, 3., "serif")
    ax.text(0.5, 2., "monospace", family="monospace")
    ax.text(2.5, 2., "sans-serif", family="DejaVu Sans")  # Use specific sans font.
    ax.text(2.5, 1., "comic", family="cursive")
    ax.set_xlabel("µ is not $\\mu$")

    fig.tight_layout(pad=.5)

    fig.savefig("pgf_fonts.pdf")
    fig.savefig("pgf_fonts.png")


.. _sphx_glr_download_gallery_userdemo_pgf_fonts.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: pgf_fonts.py <pgf_fonts.py>`



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

     :download:`Download Jupyter notebook: pgf_fonts.ipynb <pgf_fonts.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>`_
