Note

Go to the endto download the full example code. or to run this example in your browser via JupyterLite or Binder

Choosing the thumbnail figure#

This example demonstrates how to choose the figure that is displayed as thethumbnail, if the example generates more than one figure. This is done byspecifying the keyword-value pairsphinx_gallery_thumbnail_number=<fignumber> as acomment somewhere below the docstring in the example file. In this example, wespecify that we wish for the second figure to be the thumbnail.

  • plot 4 choose thumbnail
  • plot 4 choose thumbnail
# Code source: Óscar Nájera# License: BSD 3 clauseimportmatplotlib.pyplotaspltimportnumpyasnpdefmain():"""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 = 2plt.figure()plt.plot(x,-np.exp(-x),color="orange",linewidth=4)plt.xlabel("$x$")plt.ylabel(r"$-\exp(-x)$")# To avoid matplotlib text outputplt.show()if__name__=="__main__":main()

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

Estimated memory usage: 193 MB

Gallery generated by Sphinx-Gallery