Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3388 from sciunto/doc_data
Show our data in the gallery
- Loading branch information
Showing
4 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Data | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |