Note
Click here to download the full example code
Link to other packagesΒΆ
Use sphinx_gallery
to link to other packages, like
numpy
, matplotlib.colors
, and matplotlib.pyplot
.
FYI this gallery uses sphinx_gallery.sorting.FileNameSortKey
.

Out:
True
/home/lucy/Documents/sphinx-gallery/sphinx_gallery/tests/tinybuild/examples/plot_numpy_matplotlib.py:37: RuntimeWarning: This warning should show up in the output
warn('This warning should show up in the output', RuntimeWarning)
Property
from warnings import warn
import numpy as np
from matplotlib.colors import is_color_like
from matplotlib.figure import Figure
from itertools import compress # noqa
import matplotlib
import matplotlib.pyplot as plt
import sphinx_gallery.backreferences
from local_module import N # N = 1000
t = np.arange(N) / float(N)
win = np.hanning(N)
print(is_color_like('r'))
fig, ax = plt.subplots()
ax.plot(t, win, color='r')
ax.text(0, 1, 'png', size=40, va='top')
fig.tight_layout()
orig_dpi = 80. if matplotlib.__version__[0] < '2' else 100.
assert plt.rcParams['figure.dpi'] == orig_dpi
plt.rcParams['figure.dpi'] = 70.
assert plt.rcParams['figure.dpi'] == 70.
listy = [0, 1]
compress('abc', [0, 0, 1])
warn('This warning should show up in the output', RuntimeWarning)
x = Figure() # plt.Figure should be decorated (class), x shouldn't (inst)
# nested resolution resolves to numpy.random.mtrand.RandomState:
rng = np.random.RandomState(0)
# test Issue 583
sphinx_gallery.backreferences.identify_names([('text', 'Text block', 1)])
# 583: methods don't link properly
dc = sphinx_gallery.backreferences.DummyClass()
dc.run()
print(dc.prop)
Total running time of the script: ( 0 minutes 0.145 seconds)