Can not display image using plot in spider

import os

import numpy as np

import skimage.io as skio

vol=skio.imread(‘file:///C:/Users/paka874c/Desktop/diatom_late_1_040nm_recApp1_2.labels.tif’)
print(vol.shape) # vol size (1753,584,1780)

subvol=vol[301:800,300:800,300:1200]

subvol=vol[300:800,300:600,300:1200]

subvol=vol[300:800,300:550,300:1200]

import matplotlib.pyplot as plt

plt.imshow(subvol[250])

error:Invalid shape (500, 250, 900) for image data and no image on plots its empty

can anybody solve my problem please ? I cant find any solution

Here is the documentation for pyplot.imshow. As you can see there, the expected input image has to have a certain shape.

The image data. Supported array shapes are:

* (M, N): an image with scalar data. The values are mapped to colors using normalization and a colormap. See parameters *norm*, *cmap*, *vmin*, *vmax*.
* (M, N, 3): an image with RGB values (0-1 float or 0-255 int).
* (M, N, 4): an image with RGBA values (0-1 float or 0-255 int), i.e. including transparency.

However, the “image” that you want to plot has the shape 500 x 250 x 900. This means that you have 900 in the third dimension, but only 3 or 4 are supported.

Maybe you can take a look at how the images are stored in order to determine where is one valid image, select it and then you can plot it.