mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-14 11:18:06 +08:00
Both inline plots and plots from script files work. Some things to keep in mind: - for including scripts from docstrings, use prefix "../plots/", for including scripts in a rst file, use "plots/". This is due to the docs being generated from the source/api folder. - inline plots are not (yet) aware of variables being defined earlier in the Examples section. - we now use the numpydoc sphinx extensions, the original MPL ones can not be used because they have no support for the make file and conf.py not being in the same folder. There is one minor thing that does not work yet. The source code link for plots does not work because for some reason the script files are not copied to the build dir.
29 lines
645 B
Python
29 lines
645 B
Python
import os
|
|
|
|
import matplotlib.pyplot as plt
|
|
from mpl_toolkits.axes_grid import AxesGrid
|
|
import numpy as np
|
|
|
|
from scikits.image.io import MultiImage
|
|
from scikits.image import data_dir
|
|
|
|
|
|
fname = os.path.join(data_dir, 'multipage.tif')
|
|
img = MultiImage(fname)
|
|
|
|
fig = plt.figure()
|
|
grid = AxesGrid(fig, 111,
|
|
nrows_ncols = (1, 2),
|
|
axes_pad = 0.1,
|
|
add_all=True,
|
|
label_mode = "L",
|
|
aspect=True)
|
|
|
|
for i, frame in enumerate(img):
|
|
grid[i].imshow(frame, cmap=plt.cm.gray)
|
|
grid[i].set_xlabel('Frame %s'%i)
|
|
grid[i].set_xticks([])
|
|
grid[i].set_yticks([])
|
|
|
|
plt.show()
|