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

.. only:: html

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

        :ref:`Go to the end <sphx_glr_download_auto_examples_plot_4_choose_thumbnail.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_4_choose_thumbnail.py:


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

This example demonstrates how to choose the figure that 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 = <fig number>`` as a
comment somewhere below the docstring in the example file. In this example, we
specify that we wish for the second figure to be the thumbnail.

.. GENERATED FROM PYTHON SOURCE LINES 12-43



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


    *

      .. image-sg:: /auto_examples/images/sphx_glr_plot_4_choose_thumbnail_001.png
         :alt: plot 4 choose thumbnail
         :srcset: /auto_examples/images/sphx_glr_plot_4_choose_thumbnail_001.png, /auto_examples/images/sphx_glr_plot_4_choose_thumbnail_001_2_00x.png 2.00x
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /auto_examples/images/sphx_glr_plot_4_choose_thumbnail_002.png
         :alt: plot 4 choose thumbnail
         :srcset: /auto_examples/images/sphx_glr_plot_4_choose_thumbnail_002.png, /auto_examples/images/sphx_glr_plot_4_choose_thumbnail_002_2_00x.png 2.00x
         :class: sphx-glr-multi-img





.. code-block:: Python


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

    import matplotlib.pyplot as plt
    import numpy as np


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

        plt.figure()
        plt.plot(x, y)
        plt.xlabel("$x$")
        plt.ylabel(r"$\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(r"$-\exp(-x)$")
        # To avoid matplotlib text output
        plt.show()


    if __name__ == "__main__":
        main()


.. _sphx_glr_download_auto_examples_plot_4_choose_thumbnail.py:

.. only:: html

  .. container:: sphx-glr-footer 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_4_choose_thumbnail.ipynb
        :alt: Launch binder
        :width: 150 px

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

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

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

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

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: plot_4_choose_thumbnail.zip <plot_4_choose_thumbnail.zip>`


.. only:: html

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

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