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

Previous topic

pylab_examples example code: text_rotation_relative_to_line.py

Next topic

pylab_examples example code: to_numeric.py

This Page

pylab_examples example code: titles_demo.pyΒΆ

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

../../_images/titles_demo.png
#!/usr/bin/env python
"""
matplotlib can display plot titles centered, flush with the left side of
a set of axes, and flush with the right side of a set of axes.

"""
import matplotlib.pyplot as plt

plt.plot(range(10))

plt.title('Center Title')
plt.title('Left Title', loc='left')
plt.title('Right Title', loc='right')

plt.show()

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