File: plot_4b_provide_thumbnail.py

package info (click to toggle)
sphinx-gallery 0.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,336 kB
  • sloc: python: 10,346; makefile: 216; lisp: 15; sh: 11; cpp: 9
file content (43 lines) | stat: -rw-r--r-- 917 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
Providing a figure for the thumbnail image
==========================================

This example demonstrates how to provide a figure that is displayed as the
thumbnail. This is done by specifying the keyword-value pair
``sphinx_gallery_thumbnail_path = 'fig path'`` as a comment somewhere below the
docstring in the example file. In this example, we specify that we wish the
figure ``demo.png`` in the folder ``_static`` to be used for the thumbnail.
"""

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)

# %%
# Plot 1
# ------

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

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