.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        Click :ref:`here <sphx_glr_download_auto_examples_plot_matplotlib_alt.py>`     to download the full example code
    .. rst-class:: sphx-glr-example-title

    .. _sphx_glr_auto_examples_plot_matplotlib_alt.py:


======================
Matplotlib alt text
======================

This example tests that the alt text is generated correctly for matplotlib
figures.


.. code-block:: python3


    import matplotlib.pyplot as plt

    fig, axs = plt.subplots(2, 1, constrained_layout=True)
    axs[0].plot([1, 2, 3])
    axs[0].set_title('subplot 1')
    axs[0].set_xlabel('x label')
    axs[0].set_ylabel('y lab')
    fig.suptitle('This is a\nsup title')

    axs[1].plot([2, 3, 4])
    axs[1].set_title('subplot 2')
    axs[1].set_xlabel('x label')
    axs[1].set_ylabel('y label')

    plt.show()





.. image:: /auto_examples/images/sphx_glr_plot_matplotlib_alt_001.png
    :alt: This is a sup title, subplot 1, subplot 2
    :class: sphx-glr-single-img





Several titles.


.. code-block:: python3


    plt.plot(range(10))

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

    plt.show()



.. image:: /auto_examples/images/sphx_glr_plot_matplotlib_alt_002.png
    :alt: Left Title, Center Title, Right Title
    :class: sphx-glr-single-img






.. rst-class:: sphx-glr-timing

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


.. _sphx_glr_download_auto_examples_plot_matplotlib_alt.py:


.. only :: html

 .. container:: sphx-glr-footer
    :class: sphx-glr-footer-example



  .. container:: sphx-glr-download sphx-glr-download-python

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



  .. container:: sphx-glr-download sphx-glr-download-jupyter

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


.. only:: html

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

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