Jul-27-2020, 09:48 AM
Dear All,
I have read each single image from stacked file *.tif separately, using the following code,
dataset = rasterio.open('D:\data_stacked_2015.tif')
fig, (axes1, axes2, axes3) = pyplot.subplots(1,3, figsize=(21,7))
show((dataset, 64), ax = axes1, cmap='gray', title='red channel')
show((dataset, 65), ax = axes2, cmap='gray', title='green channel')
show((dataset, 66), ax = axes3, cmap='gray', title='blue channel')
for ax in axes1, axes2, axes3:
ax.axis('off')
plt.show()
But, What I'd like to do is, to read the whole stacked images as subplot, using for loop, However, the following doesn't work,
dataset = rasterio.open('D:\data_stacked_2015.tif')
# Create subplots
rows, cols = 10, 7
fig, ax = pyplot.subplots(rows, cols,
sharex='col',
sharey='row',
figsize=(21,7))
for axes in range(10):
for col in range(7):
image = show((dataset), axes, cmap='gray')
plt.show()
Any suggestions pleas, and many thanks in advance.
I have read each single image from stacked file *.tif separately, using the following code,
dataset = rasterio.open('D:\data_stacked_2015.tif')
fig, (axes1, axes2, axes3) = pyplot.subplots(1,3, figsize=(21,7))
show((dataset, 64), ax = axes1, cmap='gray', title='red channel')
show((dataset, 65), ax = axes2, cmap='gray', title='green channel')
show((dataset, 66), ax = axes3, cmap='gray', title='blue channel')
for ax in axes1, axes2, axes3:
ax.axis('off')
plt.show()
But, What I'd like to do is, to read the whole stacked images as subplot, using for loop, However, the following doesn't work,
dataset = rasterio.open('D:\data_stacked_2015.tif')
# Create subplots
rows, cols = 10, 7
fig, ax = pyplot.subplots(rows, cols,
sharex='col',
sharey='row',
figsize=(21,7))
for axes in range(10):
for col in range(7):
image = show((dataset), axes, cmap='gray')
plt.show()
Any suggestions pleas, and many thanks in advance.