A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://sphinx-gallery.github.io/stable/auto_examples/plot_4_choose_thumbnail.html below:

Choosing the thumbnail figure — Sphinx-Gallery 0.19.0-git documentation

Note

Go to the end to 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 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.

# 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()

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

Estimated memory usage: 193 MB

Gallery generated by Sphinx-Gallery


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4