.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_subplots_axes_and_figures_figure_title.py: ============ Figure Title ============ Create a figure with separate subplot titles and a centered figure title. .. image:: /gallery/subplots_axes_and_figures/images/sphx_glr_figure_title_001.png :class: sphx-glr-single-img .. code-block:: python from matplotlib.font_manager import FontProperties import matplotlib.pyplot as plt import numpy as np def f(t): s1 = np.cos(2*np.pi*t) e1 = np.exp(-t) return s1 * e1 t1 = np.arange(0.0, 5.0, 0.1) t2 = np.arange(0.0, 5.0, 0.02) t3 = np.arange(0.0, 2.0, 0.01) plt.subplot(121) plt.plot(t1, f(t1), 'o', t2, f(t2), '-') plt.title('subplot 1') plt.ylabel('Damped oscillation') plt.suptitle('This is a somewhat long figure title', fontsize=16) plt.subplot(122) plt.plot(t3, np.cos(2*np.pi*t3), '--') plt.xlabel('time (s)') plt.title('subplot 2') plt.ylabel('Undamped') plt.subplots_adjust(left=0.2, wspace=0.8, top=0.8) plt.show() .. _sphx_glr_download_gallery_subplots_axes_and_figures_figure_title.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: figure_title.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: figure_title.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature Keywords: matplotlib code example, codex, python plot, pyplot `Gallery generated by Sphinx-Gallery `_