

.. _sphx_glr_gallery_text_labels_and_annotations_titles_demo.py:


===========
Titles Demo
===========

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.





.. image:: /gallery/text_labels_and_annotations/images/sphx_glr_titles_demo_001.png
    :align: center





.. code-block:: python

    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()

**Total running time of the script:** ( 0 minutes  0.071 seconds)



.. only :: html

 .. container:: sphx-glr-footer


  .. container:: sphx-glr-download

     :download:`Download Python source code: titles_demo.py <titles_demo.py>`



  .. container:: sphx-glr-download

     :download:`Download Jupyter notebook: titles_demo.ipynb <titles_demo.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_
