.. _sphx_glr_gallery_userdemo_pgf_fonts_sgskip.py: ========= Pgf Fonts ========= .. code-block:: python # -*- coding: utf-8 -*- import matplotlib as mpl mpl.use("pgf") pgf_with_rc_fonts = { "font.family": "serif", "font.serif": [], # use latex default serif font "font.sans-serif": ["DejaVu Sans"], # use a specific sans-serif font } mpl.rcParams.update(pgf_with_rc_fonts) import matplotlib.pyplot as plt plt.figure(figsize=(4.5, 2.5)) plt.plot(range(5)) plt.text(0.5, 3., "serif") plt.text(0.5, 2., "monospace", family="monospace") plt.text(2.5, 2., "sans-serif", family="sans-serif") plt.text(2.5, 1., "comic sans", family="Comic Sans MS") plt.xlabel(u"ยต is not $\\mu$") plt.tight_layout(.5) plt.savefig("pgf_fonts.pdf") plt.savefig("pgf_fonts.png") **Total running time of the script:** ( 0 minutes 0.000 seconds) .. only :: html .. container:: sphx-glr-footer .. container:: sphx-glr-download :download:`Download Python source code: pgf_fonts_sgskip.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: pgf_fonts_sgskip.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_