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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
"""
===============
Specific images
===============
"""
import matplotlib.pyplot as plt
import matplotlib
from skimage import data
matplotlib.rcParams["font.size"] = 18
######################################################################
#
# Stereo images
# =============
fig, axes = plt.subplots(1, 2, figsize=(8, 4))
ax = axes.ravel()
cycle_images = data.stereo_motorcycle()
ax[0].imshow(cycle_images[0])
ax[1].imshow(cycle_images[1])
fig.tight_layout()
plt.show()
######################################################################
#
# PIV images
# =============
fig, axes = plt.subplots(1, 2, figsize=(8, 4))
ax = axes.ravel()
vortex_images = data.vortex()
ax[0].imshow(vortex_images[0])
ax[1].imshow(vortex_images[1])
fig.tight_layout()
plt.show()
######################################################################
#
# Faces and non-faces dataset
# ===========================
#
# A sample of 20 over 200 images is displayed.
fig, axes = plt.subplots(4, 5, figsize=(20, 20))
ax = axes.ravel()
lfw_images = data.lfw_subset()
for i in range(20):
ax[i].imshow(lfw_images[90 + i], cmap=plt.cm.gray)
ax[i].axis("off")
fig.tight_layout()
plt.show()
######################################################################
# Thumbnail image for the gallery
# sphinx_gallery_thumbnail_number = -1
from matplotlib.offsetbox import AnchoredText
# Create a gridspec with two images in the first and 4 in the second row
fig, axd = plt.subplot_mosaic(
[["stereo", "stereo", "piv", "piv"], ["lfw0", "lfw1", "lfw2", "lfw3"]],
)
axd["stereo"].imshow(cycle_images[0])
axd["stereo"].add_artist(
AnchoredText(
"Stereo",
prop=dict(size=20),
frameon=True,
borderpad=0,
loc="upper left",
)
)
axd["piv"].imshow(vortex_images[0])
axd["piv"].add_artist(
AnchoredText(
"PIV",
prop=dict(size=20),
frameon=True,
borderpad=0,
loc="upper left",
)
)
axd["lfw0"].imshow(lfw_images[91], cmap="gray")
axd["lfw1"].imshow(lfw_images[92], cmap="gray")
axd["lfw2"].imshow(lfw_images[93], cmap="gray")
axd["lfw3"].imshow(lfw_images[94], cmap="gray")
for ax in axd.values():
ax.axis("off")
fig.tight_layout()
plt.show()
|