mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-04 10:47:04 +08:00
made plot loop more readable
This commit is contained in:
@@ -58,7 +58,7 @@ fig = plt.figure(figsize=(8, 8))
|
||||
# display original image with locations of patches
|
||||
ax = fig.add_subplot(3, 2, 1)
|
||||
ax.imshow(image, cmap=plt.cm.gray, interpolation='nearest',
|
||||
vmin=0, vmax=255)
|
||||
vmin=0, vmax=255)
|
||||
for (y, x) in grass_locations:
|
||||
ax.plot(x + PATCH_SIZE / 2, y + PATCH_SIZE / 2, 'gs')
|
||||
for (y, x) in sky_locations:
|
||||
@@ -80,13 +80,13 @@ ax.legend()
|
||||
|
||||
# display the image patches
|
||||
for i, patch in enumerate(grass_patches):
|
||||
ax = fig.add_subplot(3, 4, 4+i+1)
|
||||
ax = fig.add_subplot(3, len(grass_patches), len(grass_patches)*1 + i + 1)
|
||||
ax.imshow(patch, cmap=plt.cm.gray, interpolation='nearest',
|
||||
vmin=0, vmax=255)
|
||||
ax.set_xlabel('Grass %d' % (i + 1))
|
||||
|
||||
for i, patch in enumerate(sky_patches):
|
||||
ax = fig.add_subplot(3, 4, 4*2+i+1)
|
||||
ax = fig.add_subplot(3, len(sky_patches), len(sky_patches)*2 + i + 1)
|
||||
ax.imshow(patch, cmap=plt.cm.gray, interpolation='nearest',
|
||||
vmin=0, vmax=255)
|
||||
ax.set_xlabel('Sky %d' % (i + 1))
|
||||
|
||||
Reference in New Issue
Block a user