You are reading an old version of the documentation (v1.4.3). For the latest version see https://matplotlib.org/stable/

We're updating the default styles for Matplotlib 2.0

Learn what to expect in the new updates

matplotlib

Previous topic

pylab_examples Examples

Next topic

pylab_examples example code: agg_buffer_to_array.py

This Page

pylab_examples example code: accented_text.pyΒΆ

(Source code, png, hires.png, pdf)

../../_images/accented_text.png
#!/usr/bin/env python
"""
matplotlib supports accented characters via TeX mathtext

The following accents are provided: \hat, \breve, \grave, \bar,
\acute, \tilde, \vec, \dot, \ddot.  All of them have the same syntax,
e.g., to make an overbar you do \bar{o} or to make an o umlaut you do
\ddot{o}.  The shortcuts are also provided, e.g.,: \"o \'e \`e \~n \.x
\^y

"""
from pylab import *

axes([0.1, 0.15, 0.8, 0.75])
plot(range(10))

title(r'$\ddot{o}\acute{e}\grave{e}\hat{O}\breve{i}\bar{A}\tilde{n}\vec{q}$', fontsize=20)
# shorthand is also supported and curly's are optional
xlabel(r"""$\"o\ddot o \'e\`e\~n\.x\^y$""", fontsize=20)


show()

Keywords: python, matplotlib, pylab, example, codex (see Search examples)