From 80a366761c338028e973a688f8814ab20c0ab97f Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Wed, 14 Oct 2009 08:02:39 +0200 Subject: [PATCH] Shorten and comment show_collection example. --- doc/source/plots/show_collection.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/doc/source/plots/show_collection.py b/doc/source/plots/show_collection.py index cb88e12f..4d89de80 100644 --- a/doc/source/plots/show_collection.py +++ b/doc/source/plots/show_collection.py @@ -2,26 +2,25 @@ 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 - +# Load the multi-layer image fname = os.path.join(data_dir, 'multipage.tif') img = MultiImage(fname) +# Create an image grid fig = plt.figure() -grid = AxesGrid(fig, 111, - nrows_ncols = (1, 2), - axes_pad = 0.1, - add_all=True, - label_mode = "L", - aspect=True) +grid = AxesGrid(fig, + rect=(1, 1, 1), + nrows_ncols=(1, 2), + axes_pad=0.1) +# Plot the layers on the image grid for i, frame in enumerate(img): grid[i].imshow(frame, cmap=plt.cm.gray) - grid[i].set_xlabel('Frame %s'%i) + grid[i].set_xlabel('Frame %s' % i) grid[i].set_xticks([]) grid[i].set_yticks([])