Skip to content

Commit

Permalink
Merge pull request #3388 from sciunto/doc_data
Browse files Browse the repository at this point in the history
Show our data in the gallery
  • Loading branch information
emmanuelle committed Oct 9, 2018
2 parents 942ed29 + 7d48ee0 commit 9cb7cd3
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/examples/data/README.txt
@@ -0,0 +1,2 @@
Data
----
42 changes: 42 additions & 0 deletions doc/examples/data/plot_general.py
@@ -0,0 +1,42 @@
"""
======================
General-purpose images
======================
The title of each image indicates the name of the function.
"""
import matplotlib.pyplot as plt
import matplotlib

from skimage import data

matplotlib.rcParams['font.size'] = 18

images = ('astronaut',
'binary_blobs',
'camera',
'checkerboard',
'chelsea',
'clock',
'coffee',
'coins',
'horse',
'logo',
'page',
'text',
'rocket',
)


for name in images:
caller = getattr(data, name)
image = caller()
plt.figure()
plt.title(name)
if image.ndim == 2:
plt.imshow(image, cmap=plt.cm.gray)
else:
plt.imshow(image)

plt.show()
32 changes: 32 additions & 0 deletions doc/examples/data/plot_scientific.py
@@ -0,0 +1,32 @@
"""
=================
Scientific images
=================
The title of each image indicates the name of the function.
"""
import matplotlib.pyplot as plt
import matplotlib

from skimage import data

matplotlib.rcParams['font.size'] = 18

images = ('hubble_deep_field',
'immunohistochemistry',
'moon',
)


for name in images:
caller = getattr(data, name)
image = caller()
plt.figure()
plt.title(name)
if image.ndim == 2:
plt.imshow(image, cmap=plt.cm.gray)
else:
plt.imshow(image)

plt.show()
46 changes: 46 additions & 0 deletions doc/examples/data/plot_specific.py
@@ -0,0 +1,46 @@
"""
===============
Specific images
===============
"""
import numpy as np
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()

images = data.stereo_motorcycle()
ax[0].imshow(images[0])
ax[1].imshow(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()
images = data.lfw_subset()
for i in range(20):
ax[i].imshow(images[90+i], cmap=plt.cm.gray)
ax[i].axis('off')
fig.tight_layout()
plt.show()

0 comments on commit 9cb7cd3

Please sign in to comment.