Lipai's Notebook Logo
Jul 2020
  • Pai Li (李湃)
  • Periodic Table
  • Unit Conversion
  • Vasp
  • Scripts for job management system on super-computer
  • kMC simulation
  • Machine Learning tools
  • Python Scripts
  • Math notation in Latex
  • Vim skills
  • A ReStructuredText Primer
  • PDF documents
  • Gallery of python scripts
    • General examples
      • Plotting the exponential function
      • Plotting the exponential function
      • Plotting the exponential function
      • Colormaps alter your perception
      • Some Quantum Mechanics, filling an atomic orbital
      • Choosing the thumbnail figure
      • Sphinx-Gallery introduction
Lipai's Notebook
  • »
  • Gallery of python scripts »
  • Sphinx-Gallery introduction
  • View page source

Note

Click here to download the full example code

Sphinx-Gallery introduction¶

Plot to present Sphinx-Gallery using itself to display its version.

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

import numpy as np
import matplotlib.pyplot as plt
import sphinx_gallery

np.random.seed(32)


def layers(n, m):
    """
    Return *n* random Gaussian mixtures, each of length *m*.
    """
    def bump(a):
        x = 1 / (.1 + np.random.random())
        y = 2 * np.random.random() - .3
        z = 13 / (.1 + np.random.random())
        for i in range(m):
            w = (i / float(m) - y) * z
            a[i] += x * np.exp(-w * w)
    a = np.zeros((m, n))
    for i in range(n):
        for j in range(12):
            bump(a[:, i])
    return np.abs(a)


fig = plt.figure()
d = layers(3, 100)
x = list(range(100))
for mixture in d.T:
    mixture[[0, -1]] = 0.
    plt.fill(x, mixture, alpha=0.9)

plt.annotate('Introducing Sphinx-Gallery ' + sphinx_gallery.__version__,
             xy=(12, 4), arrowprops=dict(arrowstyle='->'), xytext=(22, 6))

plt.xticks([])
plt.yticks([])


plt.show()

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

Download Python source code: plot_gallery_version.py

Download Jupyter notebook: plot_gallery_version.ipynb

Gallery generated by Sphinx-Gallery

Next Previous

© Copyright 2020-2023, lipai@mail.ustc.edu.cn. Last updated on Mar 06, 2021.

Built with Sphinx using a theme provided by Read the Docs.