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

    Click :ref:`here <sphx_glr_download_auto_examples_plot_choose_thumbnail.py>` to download the full example code or run this example in your browser via Binder
.. rst-class:: sphx-glr-example-title

.. _sphx_glr_auto_examples_plot_choose_thumbnail.py:


Choosing the thumbnail figure
=============================

An example to demonstrate how to choose which figure is displayed as the
thumbnail if the example generates more than one figure. This is done by
specifying the keyword-value pair ``sphinx_gallery_thumbnail_number = 2`` as a
comment somewhere below the docstring in the example file.



.. rst-class:: sphx-glr-horizontal


    *

      .. image:: /auto_examples/images/sphx_glr_plot_choose_thumbnail_001.png
            :class: sphx-glr-multi-img

    *

      .. image:: /auto_examples/images/sphx_glr_plot_choose_thumbnail_002.png
            :class: sphx-glr-multi-img





.. code-block:: python


    # Code source: Óscar Nájera
    # License: BSD 3 clause

    import numpy as np
    import matplotlib.pyplot as plt


    def main():
        x = np.linspace(-1, 2, 100)
        y = np.exp(x)

        plt.figure()
        plt.plot(x, y)
        plt.xlabel('$x$')
        plt.ylabel('$\exp(x)$')

        # The next line sets the thumbnail for the second figure in the gallery
        #   (plot with negative exponential in orange)
        # sphinx_gallery_thumbnail_number = 2
        plt.figure()
        plt.plot(x, -np.exp(-x), color='orange', linewidth=4)
        plt.xlabel('$x$')
        plt.ylabel('$-\exp(-x)$')

        plt.show()


    if __name__ == '__main__':
        main()

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


.. _sphx_glr_download_auto_examples_plot_choose_thumbnail.py:


.. only :: html

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


  .. container:: binder-badge

    .. image:: https://static.mybinder.org/badge.svg
      :target: https://mybinder.org/v2/gh/sphinx-gallery/sphinx-gallery.github.io/master?urlpath=lab/tree/notebooks/auto_examples/plot_choose_thumbnail.ipynb
      :width: 150 px


  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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


.. only:: html

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

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