From 6a8f5fefd63e46b0de43dfad4bb4917131b9a946 Mon Sep 17 00:00:00 2001 From: Siva Prasad Varma Date: Wed, 19 Mar 2014 17:30:20 +0530 Subject: [PATCH] changed f to fig in applications --- .../applications/plot_coins_segmentation.py | 22 +++++++-------- .../applications/plot_rank_filters.py | 28 +++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/doc/examples/applications/plot_coins_segmentation.py b/doc/examples/applications/plot_coins_segmentation.py index b292eaa2..49ff399f 100644 --- a/doc/examples/applications/plot_coins_segmentation.py +++ b/doc/examples/applications/plot_coins_segmentation.py @@ -16,7 +16,7 @@ from skimage import data coins = data.coins() hist = np.histogram(coins, bins=np.arange(0, 256)) -f, (ax1, ax2) = plt.subplots(1, 2, figsize=(8, 3)) +fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(8, 3)) ax1.imshow(coins, cmap=plt.cm.gray, interpolation='nearest') ax1.axis('off') ax2.plot(hist[1][:-1], hist[0], lw=2) @@ -35,7 +35,7 @@ background with the coins: """ -f, (ax1, ax2) = plt.subplots(1, 2, figsize=(6, 3)) +fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(6, 3)) ax1.imshow(coins > 100, cmap=plt.cm.gray, interpolation='nearest') ax1.set_title('coins > 100') ax1.axis('off') @@ -43,7 +43,7 @@ ax2.imshow(coins > 150, cmap=plt.cm.gray, interpolation='nearest') ax2.set_title('coins > 150') ax2.axis('off') margins = dict(hspace=0.01, wspace=0.01, top=1, bottom=0, left=0, right=1) -f.subplots_adjust(**margins) +fig.subplots_adjust(**margins) """ .. image:: PLOT2RST.current_figure @@ -60,7 +60,7 @@ edge-detector. from skimage.filter import canny edges = canny(coins/255.) -f, ax = plt.subplots(figsize=(4, 3)) +fig, ax = plt.subplots(figsize=(4, 3)) ax.imshow(edges, cmap=plt.cm.gray, interpolation='nearest') ax.axis('off') ax.set_title('Canny detector') @@ -75,7 +75,7 @@ from scipy import ndimage fill_coins = ndimage.binary_fill_holes(edges) -f, ax = plt.subplots(figsize=(4, 3)) +fig, ax = plt.subplots(figsize=(4, 3)) ax.imshow(fill_coins, cmap=plt.cm.gray, interpolation='nearest') ax.axis('off') ax.set_title('Filling the holes') @@ -89,7 +89,7 @@ objects. from skimage import morphology coins_cleaned = morphology.remove_small_objects(fill_coins, 21) -f, ax = plt.subplots(figsize=(4, 3)) +fig, ax = plt.subplots(figsize=(4, 3)) ax.imshow(coins_cleaned, cmap=plt.cm.gray, interpolation='nearest') ax.axis('off') ax.set_title('Removing small objects') @@ -113,7 +113,7 @@ from skimage.filter import sobel elevation_map = sobel(coins) -f, ax = plt.subplots(figsize=(4, 3)) +fig, ax = plt.subplots(figsize=(4, 3)) ax.imshow(elevation_map, cmap=plt.cm.jet, interpolation='nearest') ax.axis('off') ax.set_title('elevation_map') @@ -129,7 +129,7 @@ markers = np.zeros_like(coins) markers[coins < 30] = 1 markers[coins > 150] = 2 -f, ax = plt.subplots(figsize=(4, 3)) +fig, ax = plt.subplots(figsize=(4, 3)) ax.imshow(markers, cmap=plt.cm.spectral, interpolation='nearest') ax.axis('off') ax.set_title('markers') @@ -143,7 +143,7 @@ starting from the markers determined above: """ segmentation = morphology.watershed(elevation_map, markers) -f, ax = plt.subplots(figsize=(4, 3)) +fig, ax = plt.subplots(figsize=(4, 3)) ax.imshow(segmentation, cmap=plt.cm.gray, interpolation='nearest') ax.axis('off') ax.set_title('segmentation') @@ -162,14 +162,14 @@ segmentation = ndimage.binary_fill_holes(segmentation - 1) labeled_coins, _ = ndimage.label(segmentation) image_label_overlay = label2rgb(labeled_coins, image=coins) -f, (ax1, ax2) = plt.subplots(1, 2, figsize=(6, 3)) +fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(6, 3)) ax1.imshow(coins, cmap=plt.cm.gray, interpolation='nearest') ax1.contour(segmentation, [0.5], linewidths=1.2, colors='y') ax1.axis('off') ax2.imshow(image_label_overlay, interpolation='nearest') ax2.axis('off') -f.subplots_adjust(**margins) +fig.subplots_adjust(**margins) """ .. image:: PLOT2RST.current_figure diff --git a/doc/examples/applications/plot_rank_filters.py b/doc/examples/applications/plot_rank_filters.py index 2f9e0ca5..5fa88aa0 100644 --- a/doc/examples/applications/plot_rank_filters.py +++ b/doc/examples/applications/plot_rank_filters.py @@ -44,7 +44,7 @@ from skimage import data noisy_image = img_as_ubyte(data.camera()) hist = np.histogram(noisy_image, bins=np.arange(0, 256)) -f, (ax1, ax2) = plt.subplots(1, 2, figsize=(8, 3)) +fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(8, 3)) ax1.imshow(noisy_image, interpolation='nearest', cmap=plt.cm.gray) ax1.axis('off') ax2.plot(hist[1][:-1], hist[0], lw=2) @@ -201,7 +201,7 @@ hist = np.histogram(noisy_image, bins=np.arange(0, 256)) glob_hist = np.histogram(glob, bins=np.arange(0, 256)) loc_hist = np.histogram(loc, bins=np.arange(0, 256)) -f, ax = plt.subplots(3, 2, figsize=(10, 10)) +fig, ax = plt.subplots(3, 2, figsize=(10, 10)) ax1, ax2, ax3, ax4, ax5, ax6 = ax.ravel() ax1.imshow(noisy_image, interpolation='nearest', cmap=plt.cm.gray) @@ -398,14 +398,14 @@ loc_otsu = p8 >= t_loc_otsu t_glob_otsu = threshold_otsu(p8) glob_otsu = p8 >= t_glob_otsu -f, ax = plt.subplots(2, 2) +fig, ax = plt.subplots(2, 2) ax1, ax2, ax3, ax4 = ax.ravel() -f.colorbar(ax1.imshow(p8, cmap=plt.cm.gray), ax=ax1) +fig.colorbar(ax1.imshow(p8, cmap=plt.cm.gray), ax=ax1) ax1.set_title('Original') ax1.axis('off') -f.colorbar(ax2.imshow(t_loc_otsu, cmap=plt.cm.gray), ax=ax2) +fig.colorbar(ax2.imshow(t_loc_otsu, cmap=plt.cm.gray), ax=ax2) ax2.set_title('Local Otsu ($r=%d$)' % radius) ax2.axis('off') @@ -434,7 +434,7 @@ m = (np.tile(x, (n, 1)) * np.linspace(0.1, 1, n) * 128 + 128).astype(np.uint8) radius = 10 t = rank.otsu(m, disk(radius)) -f, (ax1, ax2) = plt.subplots(1, 2) +fig, (ax1, ax2) = plt.subplots(1, 2) ax1.imshow(m) ax1.set_title('Original') @@ -523,13 +523,13 @@ import matplotlib.pyplot as plt image = data.camera() -f, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 4)) +fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 4)) -f.colorbar(ax1.imshow(image, cmap=plt.cm.gray), ax=ax1) +fig.colorbar(ax1.imshow(image, cmap=plt.cm.gray), ax=ax1) ax1.set_title('Image') ax1.axis('off') -f.colorbar(ax2.imshow(entropy(image, disk(5)), cmap=plt.cm.jet), ax=ax2) +fig.colorbar(ax2.imshow(entropy(image, disk(5)), cmap=plt.cm.jet), ax=ax2) ax2.set_title('Entropy') ax2.axis('off') @@ -616,7 +616,7 @@ for r in e_range: rec = np.asarray(rec) -f, ax = plt.subplots() +fig, ax = plt.subplots() ax.set_title('Performance with respect to element size') ax.set_ylabel('Time (ms)') ax.set_xlabel('Element radius') @@ -644,7 +644,7 @@ for s in s_range: rec = np.asarray(rec) -f, ax = plt.subplots() +fig, ax = plt.subplots() ax.set_title('Performance with respect to image size') ax.set_ylabel('Time (ms)') ax.set_xlabel('Image size') @@ -679,7 +679,7 @@ for r in e_range: rec = np.asarray(rec) -f, ax = plt.subplots() +fig, ax = plt.subplots() ax.set_title('Performance with respect to element size') ax.plot(e_range, rec) ax.legend(['filter.rank.median', 'filter.median_filter', @@ -694,7 +694,7 @@ Comparison of outcome of the three methods: """ -f, ax = plt.subplots() +fig, ax = plt.subplots() ax.imshow(np.hstack((rc, rctmf, rndi))) ax.set_title('filter.rank.median vs filtermedian_filter vs scipy.ndimage.percentile') ax.axis('off') @@ -720,7 +720,7 @@ for s in s_range: rec = np.asarray(rec) -f, ax = plt.subplots() +fig, ax = plt.subplots() ax.set_title('Performance with respect to image size') ax.plot(s_range, rec) ax.legend(['filter.rank.median', 'filter.median_filter',