From d1e0949533ad30e2cd3e5afccbf59d835c1b0fe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Tue, 2 Jul 2013 00:32:46 +0200 Subject: [PATCH] Update entropy example with improved matplotlib usage --- doc/examples/plot_entropy.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/doc/examples/plot_entropy.py b/doc/examples/plot_entropy.py index 2c06c2bb..ed5519bd 100644 --- a/doc/examples/plot_entropy.py +++ b/doc/examples/plot_entropy.py @@ -18,16 +18,17 @@ from skimage.util import img_as_ubyte image = img_as_ubyte(data.camera()) -plt.figure(figsize=(10, 4)) +fig, (ax0, ax1) = plt.subplots(ncols=2, figsize=(10, 4)) -plt.subplot(121) -plt.imshow(image, cmap=plt.cm.gray) -plt.title('Image') -plt.colorbar() -plt.subplot(122) -plt.imshow(entropy(image, disk(5)), cmap=plt.cm.jet) -plt.title('Entropy') -plt.colorbar() +img0 = ax0.imshow(image, cmap=plt.cm.gray) +ax0.set_title('Image') +ax0.axis('off') +plt.colorbar(img0, ax=ax0) + +img1 = ax1.imshow(entropy(image, disk(5)), cmap=plt.cm.jet) +ax1.set_title('Entropy') +ax1.axis('off') +plt.colorbar(img1, ax=ax1) plt.show()