mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-29 11:26:57 +08:00
adding shared axes to examples with multiple plots
This commit is contained in:
@@ -44,21 +44,26 @@ max_view = np.max(flatten_view, axis=2)
|
||||
median_view = np.median(flatten_view, axis=2)
|
||||
|
||||
# -- display resampled images
|
||||
fig, axes = plt.subplots(2, 2, figsize=(8, 8))
|
||||
fig, axes = plt.subplots(2, 2, figsize=(8, 8), sharex=True, sharey=True)
|
||||
ax0, ax1, ax2, ax3 = axes.ravel()
|
||||
|
||||
ax0.set_title("Original rescaled with\n spline interpolation (order=3)")
|
||||
l_resized = ndi.zoom(l, 2, order=3)
|
||||
ax0.imshow(l_resized, cmap=cm.Greys_r)
|
||||
#ax0.imshow(l_resized, cmap=cm.Greys_r)
|
||||
ax0.imshow(l_resized, extent=(0, 128, 128, 0), interpolation='nearest', cmap=cm.Greys_r)
|
||||
ax0.set_axis_off()
|
||||
|
||||
ax1.set_title("Block view with\n local mean pooling")
|
||||
ax1.imshow(mean_view, cmap=cm.Greys_r)
|
||||
ax1.imshow(mean_view, interpolation='nearest', cmap=cm.Greys_r)
|
||||
ax1.set_axis_off()
|
||||
|
||||
ax2.set_title("Block view with\n local max pooling")
|
||||
ax2.imshow(max_view, cmap=cm.Greys_r)
|
||||
ax2.imshow(max_view, interpolation='nearest', cmap=cm.Greys_r)
|
||||
ax2.set_axis_off()
|
||||
|
||||
ax3.set_title("Block view with\n local median pooling")
|
||||
ax3.imshow(median_view, cmap=cm.Greys_r)
|
||||
ax3.imshow(median_view, interpolation='nearest', cmap=cm.Greys_r)
|
||||
ax3.set_axis_off()
|
||||
|
||||
fig.subplots_adjust(hspace=0.4, wspace=0.4)
|
||||
plt.show()
|
||||
|
||||
Reference in New Issue
Block a user