diff --git a/doc/examples/plot_gabor.py b/doc/examples/plot_gabor.py index fce7aff7..0ecc8468 100644 --- a/doc/examples/plot_gabor.py +++ b/doc/examples/plot_gabor.py @@ -100,19 +100,7 @@ for theta in (0, 1): # Save kernel and the power image for each image results.append((kernel, [power(img, kernel) for img in images])) -# 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') - +fig, axes = plt.subplots(nrows=5, ncols=4, figsize=(5, 6)) plt.gray() fig.suptitle('Image responses for Gabor filter kernels', fontsize=12) diff --git a/doc/examples/plot_gabors_from_astronaut.py b/doc/examples/plot_gabors_from_astronaut.py index 095af98f..ed429203 100644 --- a/doc/examples/plot_gabors_from_astronaut.py +++ b/doc/examples/plot_gabors_from_astronaut.py @@ -69,12 +69,8 @@ fb2 = fb2.reshape((-1,) + patch_shape) fb2_montage = montage2d(fb2, rescale_intensity=True) # -- -fig = plt.figure(figsize=(7, 6)) -ax0 = plt.subplot(2, 2, 1, adjustable='box-forced') -ax1 = plt.subplot(2, 2, 2) -ax2 = plt.subplot(2, 2, 3, sharex=ax0, sharey=ax0, adjustable='box-forced') -ax3 = plt.subplot(2, 2, 4) - +fig, axes = plt.subplots(2, 2, figsize=(7, 6)) +ax0, ax1, ax2, ax3 = axes.ravel() ax0.imshow(astro, cmap=plt.cm.gray) ax0.set_title("Image (original)") @@ -88,7 +84,7 @@ ax2.set_title("Image (LGN-like DoG)") ax3.imshow(fb2_montage, cmap=plt.cm.gray, interpolation='nearest') ax3.set_title("K-means filterbank (codebook)\non LGN-like DoG image") -for ax in [ax0, ax1, ax2, ax3]: +for ax in axes.ravel(): ax.axis('off') fig.subplots_adjust(hspace=0.3)