From 9fa9c0387c0dc97bc05862efb3973f1dd14e6375 Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 11 Sep 2015 09:45:34 +0200 Subject: [PATCH] adding axes sharing to displays of related images for better interaction sharing achieved by setting sharex and sharey, and setting the axes 'adjustable' parameter to 'box-forced' --- doc/examples/plot_adapt_rgb.py | 6 ++-- doc/examples/plot_blob.py | 6 +++- ...lot_circular_elliptical_hough_transform.py | 2 +- doc/examples/plot_denoise.py | 2 +- doc/examples/plot_entropy.py | 2 +- doc/examples/plot_gabor.py | 14 +++++++++- doc/examples/plot_holes_and_peaks.py | 28 ++++++++++--------- doc/examples/plot_ihc_color_separation.py | 6 ++-- doc/examples/plot_join_segmentations.py | 2 +- doc/examples/plot_local_equalize.py | 9 +++++- doc/examples/plot_log_gamma.py | 9 +++++- doc/examples/plot_marked_watershed.py | 6 ++-- doc/examples/plot_medial_transform.py | 2 +- doc/examples/plot_nonlocal_means.py | 2 +- doc/examples/plot_otsu.py | 7 ++++- doc/examples/plot_peak_local_max.py | 2 +- doc/examples/plot_phase_unwrap.py | 2 +- doc/examples/plot_rank_mean.py | 21 ++++++-------- doc/examples/plot_regional_maxima.py | 10 +++++-- doc/examples/plot_register_translation.py | 10 +++++-- doc/examples/plot_restoration.py | 2 +- doc/examples/plot_skeleton.py | 2 +- doc/examples/plot_swirl.py | 2 +- doc/examples/plot_template.py | 5 +++- 24 files changed, 105 insertions(+), 54 deletions(-) diff --git a/doc/examples/plot_adapt_rgb.py b/doc/examples/plot_adapt_rgb.py index d267cc4a..24d8f078 100644 --- a/doc/examples/plot_adapt_rgb.py +++ b/doc/examples/plot_adapt_rgb.py @@ -48,8 +48,8 @@ import matplotlib.pyplot as plt image = data.astronaut() fig = plt.figure(figsize=(14, 7)) -ax_each = fig.add_subplot(121) -ax_hsv = fig.add_subplot(122) +ax_each = fig.add_subplot(121, adjustable='box-forced') +ax_hsv = fig.add_subplot(122, sharex=ax_each, sharey=ax_each, adjustable='box-forced') # We use 1 - sobel_each(image) # but this will not work if image is not normalized @@ -107,7 +107,7 @@ def sobel_gray(image): return filters.sobel(image) fig = plt.figure(figsize=(7, 7)) -ax = fig.add_subplot(111) +ax = fig.add_subplot(111, sharex=ax_each, sharey=ax_each, adjustable='box-forced') # We use 1 - sobel_gray(image) # but this will not work if image is not normalized diff --git a/doc/examples/plot_blob.py b/doc/examples/plot_blob.py index 33cc44c2..bb5dd089 100644 --- a/doc/examples/plot_blob.py +++ b/doc/examples/plot_blob.py @@ -61,8 +61,12 @@ titles = ['Laplacian of Gaussian', 'Difference of Gaussian', 'Determinant of Hessian'] sequence = zip(blobs_list, colors, titles) + +fig,axes = plt.subplots(1, 3, sharex=True, sharey=True, subplot_kw={'adjustable':'box-forced'}) +axes = axes.ravel() for blobs, color, title in sequence: - fig, ax = plt.subplots(1, 1) + ax = axes[0] + axes = axes[1:] ax.set_title(title) ax.imshow(image, interpolation='nearest') for blob in blobs: diff --git a/doc/examples/plot_circular_elliptical_hough_transform.py b/doc/examples/plot_circular_elliptical_hough_transform.py index 684ad30b..5d5a8b2e 100755 --- a/doc/examples/plot_circular_elliptical_hough_transform.py +++ b/doc/examples/plot_circular_elliptical_hough_transform.py @@ -138,7 +138,7 @@ image_rgb[cy, cx] = (0, 0, 255) edges = color.gray2rgb(edges) edges[cy, cx] = (250, 0, 0) -fig2, (ax1, ax2) = plt.subplots(ncols=2, nrows=1, figsize=(8, 4)) +fig2, (ax1, ax2) = plt.subplots(ncols=2, nrows=1, figsize=(8, 4), sharex=True, sharey=True, subplot_kw={'adjustable':'box-forced'}) ax1.set_title('Original picture') ax1.imshow(image_rgb) diff --git a/doc/examples/plot_denoise.py b/doc/examples/plot_denoise.py index 35d05e08..f39591d2 100644 --- a/doc/examples/plot_denoise.py +++ b/doc/examples/plot_denoise.py @@ -38,7 +38,7 @@ astro = astro[220:300, 220:320] noisy = astro + 0.6 * astro.std() * np.random.random(astro.shape) noisy = np.clip(noisy, 0, 1) -fig, ax = plt.subplots(nrows=2, ncols=3, figsize=(8, 5), sharex=True, sharey=True) +fig, ax = plt.subplots(nrows=2, ncols=3, figsize=(8, 5), sharex=True, sharey=True, subplot_kw={'adjustable':'box-forced'}) plt.gray() diff --git a/doc/examples/plot_entropy.py b/doc/examples/plot_entropy.py index f33f26ff..3ca5c94e 100644 --- a/doc/examples/plot_entropy.py +++ b/doc/examples/plot_entropy.py @@ -17,7 +17,7 @@ from skimage.util import img_as_ubyte image = img_as_ubyte(data.camera()) -fig, (ax0, ax1) = plt.subplots(ncols=2, figsize=(10, 4)) +fig, (ax0, ax1) = plt.subplots(ncols=2, figsize=(10, 4), sharex=True, sharey=True, subplot_kw={'adjustable':'box-forced'}) img0 = ax0.imshow(image, cmap=plt.cm.gray) ax0.set_title('Image') diff --git a/doc/examples/plot_gabor.py b/doc/examples/plot_gabor.py index 0ecc8468..fce7aff7 100644 --- a/doc/examples/plot_gabor.py +++ b/doc/examples/plot_gabor.py @@ -100,7 +100,19 @@ for theta in (0, 1): # Save kernel and the power image for each image results.append((kernel, [power(img, kernel) for img in images])) -fig, axes = plt.subplots(nrows=5, ncols=4, figsize=(5, 6)) +# Prepare exes for ploting +fig = plt.figure(figsize=(5, 6)) +axes = np.zeros((5, 4), dtype=np.object) +# first column +for n in range(0, 5): + axes[n,0] = plt.subplot(5, 4, 1+n*4) +# the other columns, each column axes are shared +for m in range(1, 4): + axes[0,m] = plt.subplot(5, 4, 1+m, adjustable='box-forced') + for n in range(1, 5): + axes[n,m] = plt.subplot(5, 4, 1+n*4+m, sharex=axes[0,m], sharey=axes[0,m]) + axes[n,m].set_adjustable('box-forced') + plt.gray() fig.suptitle('Image responses for Gabor filter kernels', fontsize=12) diff --git a/doc/examples/plot_holes_and_peaks.py b/doc/examples/plot_holes_and_peaks.py index 90af1cbe..23c119e8 100644 --- a/doc/examples/plot_holes_and_peaks.py +++ b/doc/examples/plot_holes_and_peaks.py @@ -21,16 +21,13 @@ image = data.moon() # Rescale image intensity so that we can see dim features. image = rescale_intensity(image, in_range=(50, 200)) - -# convenience function for plotting images -def imshow(image, title, **kwargs): - fig, ax = plt.subplots(figsize=(5, 4)) - ax.imshow(image, **kwargs) - ax.axis('off') - ax.set_title(title) +fig,ax = plt.subplots(2, 2, figsize=(5, 4), sharex=True, sharey=True, subplot_kw={'adjustable':'box-forced'}) +ax = ax.ravel() -imshow(image, 'Original image') +ax[0].imshow(image) +ax[0].set_title('Original image') +ax[0].axis('off') """ .. image:: PLOT2RST.current_figure @@ -52,8 +49,9 @@ mask = image filled = reconstruction(seed, mask, method='erosion') -imshow(filled, 'after filling holes', vmin=image.min(), vmax=image.max()) - +ax[1].imshow(filled) +ax[1].set_title('after filling holes') +ax[1].axis('off') """ .. image:: PLOT2RST.current_figure @@ -63,8 +61,9 @@ isolate the dark regions by subtracting the reconstructed image from the original image. """ -imshow(image - filled, 'holes') -# plt.title('holes') +ax[2].imshow(image-filled) +ax[2].set_title('holes') +ax[2].axis('off') """ .. image:: PLOT2RST.current_figure @@ -79,7 +78,10 @@ intensity instead of the maximum. The remainder of the process is the same. seed = np.copy(image) seed[1:-1, 1:-1] = image.min() rec = reconstruction(seed, mask, method='dilation') -imshow(image - rec, 'peaks') + +ax[3].imshow(image-rec) +ax[3].set_title('peaks') +ax[3].axis('off') plt.show() """ diff --git a/doc/examples/plot_ihc_color_separation.py b/doc/examples/plot_ihc_color_separation.py index 3e297386..6191a800 100644 --- a/doc/examples/plot_ihc_color_separation.py +++ b/doc/examples/plot_ihc_color_separation.py @@ -26,7 +26,7 @@ from skimage.color import rgb2hed ihc_rgb = data.immunohistochemistry() ihc_hed = rgb2hed(ihc_rgb) -fig, axes = plt.subplots(2, 2, figsize=(7, 6)) +fig, axes = plt.subplots(2, 2, figsize=(7, 6), sharex=True, sharey=True, subplot_kw={'adjustable':'box-forced'}) ax0, ax1, ax2, ax3 = axes.ravel() ax0.imshow(ihc_rgb) @@ -61,7 +61,9 @@ h = rescale_intensity(ihc_hed[:, :, 0], out_range=(0, 1)) d = rescale_intensity(ihc_hed[:, :, 2], out_range=(0, 1)) zdh = np.dstack((np.zeros_like(h), d, h)) -fig, ax = plt.subplots() +#fig, ax = plt.subplots() +fig = plt.figure() +ax = plt.subplot(1, 1, 1, sharex=ax0, sharey=ax0, adjustable='box-forced') ax.imshow(zdh) ax.set_title("Stain separated image (rescaled)") ax.axis('off') diff --git a/doc/examples/plot_join_segmentations.py b/doc/examples/plot_join_segmentations.py index 5fded86e..0ad7e57c 100644 --- a/doc/examples/plot_join_segmentations.py +++ b/doc/examples/plot_join_segmentations.py @@ -40,7 +40,7 @@ seg2 = slic(coins, n_segments=117, max_iter=160, sigma=1, compactness=0.75, segj = join_segmentations(seg1, seg2) # show the segmentations -fig, axes = plt.subplots(ncols=4, figsize=(9, 2.5)) +fig, axes = plt.subplots(ncols=4, figsize=(9, 2.5), sharex=True, sharey=True, subplot_kw={'adjustable':'box-forced'}) axes[0].imshow(coins, cmap=plt.cm.gray, interpolation='nearest') axes[0].set_title('Image') diff --git a/doc/examples/plot_local_equalize.py b/doc/examples/plot_local_equalize.py index cce8fa42..194bfe6a 100644 --- a/doc/examples/plot_local_equalize.py +++ b/doc/examples/plot_local_equalize.py @@ -72,7 +72,14 @@ img_eq = rank.equalize(img, selem=selem) # Display results -fig, axes = plt.subplots(2, 3, figsize=(8, 5)) +fig = plt.figure(figsize=(8, 5)) +axes = np.zeros((2, 3), dtype=np.object) +axes[0,0] = plt.subplot(2, 3, 1, adjustable='box-forced') +axes[0,1] = plt.subplot(2, 3, 2, sharex=axes[0,0], sharey=axes[0,0], adjustable='box-forced') +axes[0,2] = plt.subplot(2, 3, 3, sharex=axes[0,0], sharey=axes[0,0], adjustable='box-forced') +axes[1,0] = plt.subplot(2, 3, 4) +axes[1,1] = plt.subplot(2, 3, 5) +axes[1,2] = plt.subplot(2, 3, 6) ax_img, ax_hist, ax_cdf = plot_img_and_hist(img, axes[:, 0]) ax_img.set_title('Low contrast image') diff --git a/doc/examples/plot_log_gamma.py b/doc/examples/plot_log_gamma.py index 04a1edbb..70d5881c 100644 --- a/doc/examples/plot_log_gamma.py +++ b/doc/examples/plot_log_gamma.py @@ -54,7 +54,14 @@ gamma_corrected = exposure.adjust_gamma(img, 2) logarithmic_corrected = exposure.adjust_log(img, 1) # Display results -fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(8, 5)) +fig = plt.figure(figsize=(8, 5)) +axes = np.zeros((2,3), dtype=np.object) +axes[0, 0] = plt.subplot(2, 3, 1, adjustable='box-forced') +axes[0, 1] = plt.subplot(2, 3, 2, sharex=axes[0, 0], sharey=axes[0, 0], adjustable='box-forced') +axes[0, 2] = plt.subplot(2, 3, 3, sharex=axes[0, 0], sharey=axes[0, 0], adjustable='box-forced') +axes[1, 0] = plt.subplot(2, 3, 4) +axes[1, 1] = plt.subplot(2, 3, 5) +axes[1, 2] = plt.subplot(2, 3, 6) ax_img, ax_hist, ax_cdf = plot_img_and_hist(img, axes[:, 0]) ax_img.set_title('Low contrast image') diff --git a/doc/examples/plot_marked_watershed.py b/doc/examples/plot_marked_watershed.py index 8180f982..3365740c 100644 --- a/doc/examples/plot_marked_watershed.py +++ b/doc/examples/plot_marked_watershed.py @@ -45,7 +45,8 @@ gradient = rank.gradient(denoised, disk(2)) labels = watershed(gradient, markers) # display results -fig, axes = plt.subplots(ncols=4, figsize=(8, 2.7)) +fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(8, 8), sharex=True, sharey=True, subplot_kw={'adjustable':'box-forced'}) +axes = axes.ravel() ax0, ax1, ax2, ax3 = axes ax0.imshow(image, cmap=plt.cm.gray, interpolation='nearest') @@ -61,6 +62,5 @@ ax3.set_title("Segmented") for ax in axes: ax.axis('off') -fig.subplots_adjust(hspace=0.01, wspace=0.01, top=0.9, bottom=0, - left=0, right=1) +fig.tight_layout() plt.show() diff --git a/doc/examples/plot_medial_transform.py b/doc/examples/plot_medial_transform.py index 436e439e..8b9775cd 100644 --- a/doc/examples/plot_medial_transform.py +++ b/doc/examples/plot_medial_transform.py @@ -54,7 +54,7 @@ skel, distance = medial_axis(data, return_distance=True) # Distance to the background for pixels of the skeleton dist_on_skel = distance * skel -fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(8, 4)) +fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(8, 4), sharex=True, sharey=True, subplot_kw={'adjustable':'box-forced'}) ax1.imshow(data, cmap=plt.cm.gray, interpolation='nearest') ax1.axis('off') ax2.imshow(dist_on_skel, cmap=plt.cm.spectral, interpolation='nearest') diff --git a/doc/examples/plot_nonlocal_means.py b/doc/examples/plot_nonlocal_means.py index 207f0ca4..6082ee9c 100644 --- a/doc/examples/plot_nonlocal_means.py +++ b/doc/examples/plot_nonlocal_means.py @@ -26,7 +26,7 @@ noisy = np.clip(noisy, 0, 1) denoise = denoise_nl_means(noisy, 7, 9, 0.08) -fig, ax = plt.subplots(ncols=2, figsize=(8, 4)) +fig, ax = plt.subplots(ncols=2, figsize=(8, 4), sharex=True, sharey=True, subplot_kw={'adjustable':'box-forced'}) ax[0].imshow(noisy) ax[0].axis('off') diff --git a/doc/examples/plot_otsu.py b/doc/examples/plot_otsu.py index 14a7e7cb..c279a65b 100644 --- a/doc/examples/plot_otsu.py +++ b/doc/examples/plot_otsu.py @@ -28,7 +28,12 @@ image = camera() thresh = threshold_otsu(image) binary = image > thresh -fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(8, 2.5)) +#fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(8, 2.5)) +fig = plt.figure(figsize=(8, 2.5)) +ax1 = plt.subplot(1, 3, 1, adjustable='box-forced') +ax2 = plt.subplot(1, 3, 2) +ax3 = plt.subplot(1, 3, 3, sharex=ax1, sharey=ax1, adjustable='box-forced') + ax1.imshow(image, cmap=plt.cm.gray) ax1.set_title('Original') ax1.axis('off') diff --git a/doc/examples/plot_peak_local_max.py b/doc/examples/plot_peak_local_max.py index aba2aab0..8a690c5e 100644 --- a/doc/examples/plot_peak_local_max.py +++ b/doc/examples/plot_peak_local_max.py @@ -25,7 +25,7 @@ image_max = ndi.maximum_filter(im, size=20, mode='constant') coordinates = peak_local_max(im, min_distance=20) # display results -fig, ax = plt.subplots(1, 3, figsize=(8, 3)) +fig, ax = plt.subplots(1, 3, figsize=(8, 3), sharex=True, sharey=True, subplot_kw={'adjustable':'box-forced'}) ax1, ax2, ax3 = ax.ravel() ax1.imshow(im, cmap=plt.cm.gray) ax1.axis('off') diff --git a/doc/examples/plot_phase_unwrap.py b/doc/examples/plot_phase_unwrap.py index edb061aa..4de93dee 100644 --- a/doc/examples/plot_phase_unwrap.py +++ b/doc/examples/plot_phase_unwrap.py @@ -26,7 +26,7 @@ image_wrapped = np.angle(np.exp(1j * image)) # Perform phase unwrapping image_unwrapped = unwrap_phase(image_wrapped) -fig, ax = plt.subplots(2, 2) +fig, ax = plt.subplots(2, 2, sharex=True, sharey=True, subplot_kw={'adjustable':'box-forced'}) ax1, ax2, ax3, ax4 = ax.ravel() fig.colorbar(ax1.imshow(image, cmap='gray', vmin=0, vmax=4 * np.pi), ax=ax1) diff --git a/doc/examples/plot_rank_mean.py b/doc/examples/plot_rank_mean.py index e8f2394c..51f69788 100644 --- a/doc/examples/plot_rank_mean.py +++ b/doc/examples/plot_rank_mean.py @@ -34,19 +34,16 @@ bilateral_result = rank.mean_bilateral(image, selem=selem, s0=500, s1=500) normal_result = rank.mean(image, selem=selem) -fig, axes = plt.subplots(nrows=3, figsize=(8, 10)) -ax0, ax1, ax2 = axes +fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(8, 10), sharex=True, sharey=True) +ax = axes.ravel() -ax0.imshow(np.hstack((image, percentile_result))) -ax0.set_title('Percentile mean') -ax0.axis('off') +titles = ['Original', 'Percentile mean', 'Bilateral mean', 'Local mean'] +imgs = [image, percentile_result, bilateral_result, normal_result] +for n in range(0, len(imgs)): + ax[n].imshow(imgs[n]) + ax[n].set_title(titles[n]) + ax[n].set_adjustable('box-forced') + ax[n].axis('off') -ax1.imshow(np.hstack((image, bilateral_result))) -ax1.set_title('Bilateral mean') -ax1.axis('off') - -ax2.imshow(np.hstack((image, normal_result))) -ax2.set_title('Local mean') -ax2.axis('off') plt.show() diff --git a/doc/examples/plot_regional_maxima.py b/doc/examples/plot_regional_maxima.py index dd676014..cc65d2e5 100644 --- a/doc/examples/plot_regional_maxima.py +++ b/doc/examples/plot_regional_maxima.py @@ -36,7 +36,10 @@ Subtracting the dilated image leaves an image with just the coins and a flat, black background, as shown below. """ -fig, (ax1, ax2, ax3) = plt.subplots(ncols=3, figsize=(8, 2.5)) +fig = plt.figure(figsize=(8, 2.5)) +ax1 = plt.subplot(1, 3, 1, adjustable='box-forced') +ax2 = plt.subplot(1, 3, 2, sharex=ax1, sharey=ax1, adjustable='box-forced') +ax3 = plt.subplot(1, 3, 3, sharex=ax1, sharey=ax1, adjustable='box-forced') ax1.imshow(image) ax1.set_title('original image') @@ -76,7 +79,10 @@ mask, seed, and dilated images along a slice of the image (indicated by red line). """ -fig, (ax1, ax2, ax3) = plt.subplots(ncols=3, figsize=(8, 2.5)) +fig = plt.figure(figsize=(8, 2.5)) +ax1 = plt.subplot(1, 3, 1) +ax2 = plt.subplot(1, 3, 2, adjustable='box-forced') +ax3 = plt.subplot(1, 3, 3, sharex=ax2, sharey=ax2, adjustable='box-forced') yslice = 197 diff --git a/doc/examples/plot_register_translation.py b/doc/examples/plot_register_translation.py index 05cf78bf..c558e107 100644 --- a/doc/examples/plot_register_translation.py +++ b/doc/examples/plot_register_translation.py @@ -34,7 +34,10 @@ print(shift) # pixel precision first shift, error, diffphase = register_translation(image, offset_image) -fig, (ax1, ax2, ax3) = plt.subplots(ncols=3, figsize=(8, 3)) +fig = plt.figure(figsize=(8, 3)) +ax1 = plt.subplot(1, 3, 1, adjustable='box-forced') +ax2 = plt.subplot(1, 3, 2, sharex=ax1, sharey=ax1, adjustable='box-forced') +ax3 = plt.subplot(1, 3, 3) ax1.imshow(image) ax1.set_axis_off() @@ -60,7 +63,10 @@ print(shift) # subpixel precision shift, error, diffphase = register_translation(image, offset_image, 100) -fig, (ax1, ax2, ax3) = plt.subplots(ncols=3, figsize=(8, 3)) +fig = plt.figure(figsize=(8, 3)) +ax1 = plt.subplot(1, 3, 1, adjustable='box-forced') +ax2 = plt.subplot(1, 3, 2, sharex=ax1, sharey=ax1, adjustable='box-forced') +ax3 = plt.subplot(1, 3, 3) ax1.imshow(image) ax1.set_axis_off() diff --git a/doc/examples/plot_restoration.py b/doc/examples/plot_restoration.py index 52cbec27..221a53b7 100644 --- a/doc/examples/plot_restoration.py +++ b/doc/examples/plot_restoration.py @@ -42,7 +42,7 @@ astro += 0.1 * astro.std() * np.random.standard_normal(astro.shape) deconvolved, _ = restoration.unsupervised_wiener(astro, psf) -fig, ax = plt.subplots(nrows=1, ncols=2, figsize=(8, 5)) +fig, ax = plt.subplots(nrows=1, ncols=2, figsize=(8, 5), sharex=True, sharey=True, subplot_kw={'adjustable':'box-forced'}) plt.gray() diff --git a/doc/examples/plot_skeleton.py b/doc/examples/plot_skeleton.py index a4a3a60c..2bba3567 100644 --- a/doc/examples/plot_skeleton.py +++ b/doc/examples/plot_skeleton.py @@ -47,7 +47,7 @@ image[circle2] = 0 skeleton = skeletonize(image) # display results -fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(8, 4.5)) +fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(8, 4.5), sharex=True, sharey=True, subplot_kw={'adjustable':'box-forced'}) ax1.imshow(image, cmap=plt.cm.gray) ax1.axis('off') diff --git a/doc/examples/plot_swirl.py b/doc/examples/plot_swirl.py index 8f79db94..b93efe9f 100644 --- a/doc/examples/plot_swirl.py +++ b/doc/examples/plot_swirl.py @@ -74,7 +74,7 @@ from skimage.transform import swirl image = data.checkerboard() swirled = swirl(image, rotation=0, strength=10, radius=120, order=2) -fig, (ax0, ax1) = plt.subplots(1, 2, figsize=(8, 3)) +fig, (ax0, ax1) = plt.subplots(1, 2, figsize=(8, 3), sharex=True, sharey=True, subplot_kw={'adjustable':'box-forced'}) ax0.imshow(image, cmap=plt.cm.gray, interpolation='none') ax0.axis('off') diff --git a/doc/examples/plot_template.py b/doc/examples/plot_template.py index 08581625..c7b4f01a 100644 --- a/doc/examples/plot_template.py +++ b/doc/examples/plot_template.py @@ -33,7 +33,10 @@ result = match_template(image, coin) ij = np.unravel_index(np.argmax(result), result.shape) x, y = ij[::-1] -fig, (ax1, ax2, ax3) = plt.subplots(ncols=3, figsize=(8, 3)) +fig = plt.figure(figsize=(8, 3)) +ax1 = plt.subplot(1, 3, 1) +ax2 = plt.subplot(1, 3, 2, adjustable='box-forced') +ax3 = plt.subplot(1, 3, 3, sharex=ax2, sharey=ax2, adjustable='box-forced') ax1.imshow(coin) ax1.set_axis_off()