サムネイル画像の図を提供#

この例では、サムネイルとして表示される図を提供する方法を示します。これを行うには、例ファイル内のdocstringの下のどこかでキーワード値のペアsphinx_gallery_thumbnail_path = 'fig path'をコメントとして指定します。この例では、フォルダ_static内の図demo.pngをサムネイルに使用することを指定しています。

import matplotlib.pyplot as plt
import numpy as np

# sphinx_gallery_thumbnail_path = '_static/demo.png'
x = np.linspace(0, 4 * np.pi, 301)
y1 = np.sin(x)
y2 = np.cos(x)

プロット1#

plt.figure()
plt.plot(x, y1, label="sin")
plt.plot(x, y2, label="cos")
plt.legend()
plt.show()
plot 4b provide thumbnail

プロット2#

plt.figure()
plt.plot(x, y1, label="sin")
plt.plot(x, y2, label="cos")
plt.legend()
plt.xscale("log")
plt.yscale("log")
plt.show()
plot 4b provide thumbnail

スクリプトの合計実行時間: (0分1.683秒)

推定メモリ使用量: 176 MB

Sphinx-Galleryによって生成されたギャラリー