.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/text_labels_and_annotations/accented_text.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. meta:: :keywords: codex .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_text_labels_and_annotations_accented_text.py: ============= Accented text ============= Matplotlib supports accented characters via TeX mathtext or Unicode. Using mathtext, the following accents are provided: \\hat, \\breve, \\grave, \\bar, \\acute, \\tilde, \\vec, \\dot, \\ddot. All of them have the same syntax, e.g. \\bar{o} yields "o overbar", \\ddot{o} yields "o umlaut". Shortcuts such as \\"o \\'e \\`e \\~n \\.x \\^y are also supported. .. GENERATED FROM PYTHON SOURCE LINES 13-27 .. code-block:: Python import matplotlib.pyplot as plt # Mathtext demo fig, ax = plt.subplots() ax.plot(range(10)) ax.set_title(r'$\ddot{o}\acute{e}\grave{e}\hat{O}' r'\breve{i}\bar{A}\tilde{n}\vec{q}$', fontsize=20) # Shorthand is also supported and curly braces are optional ax.set_xlabel(r"""$\"o\ddot o \'e\`e\~n\.x\^y$""", fontsize=20) ax.text(4, 0.5, r"$F=m\ddot{x}$") fig.tight_layout() .. image-sg:: /gallery/text_labels_and_annotations/images/sphx_glr_accented_text_001.png :alt: $\ddot{o}\acute{e}\grave{e}\hat{O}\breve{i}\bar{A}\tilde{n}\vec{q}$ :srcset: /gallery/text_labels_and_annotations/images/sphx_glr_accented_text_001.png, /gallery/text_labels_and_annotations/images/sphx_glr_accented_text_001_2_00x.png 2.00x :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 28-29 You can also use Unicode characters directly in strings. .. GENERATED FROM PYTHON SOURCE LINES 29-37 .. code-block:: Python fig, ax = plt.subplots() ax.set_title("GISCARD CHAHUTÉ À L'ASSEMBLÉE") ax.set_xlabel("LE COUP DE DÉ DE DE GAULLE") ax.set_ylabel('André was here!') ax.text(0.2, 0.8, 'Institut für Festkörperphysik', rotation=45) ax.text(0.4, 0.2, 'AVA (check kerning)') plt.show() .. image-sg:: /gallery/text_labels_and_annotations/images/sphx_glr_accented_text_002.png :alt: GISCARD CHAHUTÉ À L'ASSEMBLÉE :srcset: /gallery/text_labels_and_annotations/images/sphx_glr_accented_text_002.png, /gallery/text_labels_and_annotations/images/sphx_glr_accented_text_002_2_00x.png 2.00x :class: sphx-glr-single-img .. _sphx_glr_download_gallery_text_labels_and_annotations_accented_text.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: accented_text.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: accented_text.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_