mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-05 09:05:33 +08:00
changed subplot creation to preferred matplotlib style
This commit is contained in:
@@ -35,15 +35,15 @@ background with the coins:
|
||||
|
||||
"""
|
||||
|
||||
fig = plt.figure(figsize=(6,3))
|
||||
ax1 = fig.add_subplot(1, 2, 1, adjustable='box-forced')
|
||||
ax2 = fig.add_subplot(1, 2, 2, sharex = ax1, sharey = ax1, adjustable='box-forced')
|
||||
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(6, 3), sharex=True, sharey=True)
|
||||
ax1.imshow(coins > 100, cmap=plt.cm.gray, interpolation='nearest')
|
||||
ax1.set_title('coins > 100')
|
||||
ax1.axis('off')
|
||||
ax1.set_adjustable('box-forced')
|
||||
ax2.imshow(coins > 150, cmap=plt.cm.gray, interpolation='nearest')
|
||||
ax2.set_title('coins > 150')
|
||||
ax2.axis('off')
|
||||
ax2.set_adjustable('box-forced')
|
||||
margins = dict(hspace=0.01, wspace=0.01, top=1, bottom=0, left=0, right=1)
|
||||
fig.subplots_adjust(**margins)
|
||||
|
||||
@@ -164,14 +164,14 @@ segmentation = ndi.binary_fill_holes(segmentation - 1)
|
||||
labeled_coins, _ = ndi.label(segmentation)
|
||||
image_label_overlay = label2rgb(labeled_coins, image=coins)
|
||||
|
||||
fig = plt.figure(figsize=(6,3))
|
||||
ax1 = fig.add_subplot(1, 2, 1, adjustable='box-forced')
|
||||
ax2 = fig.add_subplot(1, 2, 2, sharex = ax1, sharey = ax1, adjustable='box-forced')
|
||||
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(6, 3), sharex=True, sharey=True)
|
||||
ax1.imshow(coins, cmap=plt.cm.gray, interpolation='nearest')
|
||||
ax1.contour(segmentation, [0.5], linewidths=1.2, colors='y')
|
||||
ax1.axis('off')
|
||||
ax1.set_adjustable('box-forced')
|
||||
ax2.imshow(image_label_overlay, interpolation='nearest')
|
||||
ax2.axis('off')
|
||||
ax2.set_adjustable('box-forced')
|
||||
|
||||
fig.subplots_adjust(**margins)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user