
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/plot_matplotlib_alt.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. 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 or to run this example in your browser via Binder

.. 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.

.. GENERATED FROM PYTHON SOURCE LINES 9-27

.. 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





.. GENERATED FROM PYTHON SOURCE LINES 28-29

Several titles.

.. GENERATED FROM PYTHON SOURCE LINES 29-37

.. 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.295 seconds)


.. _sphx_glr_download_auto_examples_plot_matplotlib_alt.py:


.. only :: html

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


  .. container:: binder-badge

    .. image:: images/binder_badge_logo.svg
      :target: https://mybinder.org/v2/gh/sphinx-gallery/sphinx-gallery.github.io/master?urlpath=lab/tree/notebooks/auto_examples/plot_matplotlib_alt.ipynb
      :alt: Launch binder
      :width: 150 px


  .. 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>`_
