2

I am successfully able to subplot several images while using matshow:

fig, axes = plt.subplots(nrows=1, ncols=4)
axes[0].matshow(img_tensors, cmap='jet')
axes[0].set_title("Original Image")
axes[1].matshow(activation0[0,:,:,0], cmap='jet')
axes[1].set_title("First Activation")
axes[2].matshow(activation1[0,:,:,0], cmap='jet')
axes[2].set_title("Second Activation")
axes[3].matshow(activation2[0,:,:,0], cmap='jet')
axes[3].set_title("Third Activation")
plt.show()

enter image description here

Where the above is the output. However, if I try to change this into a 2x2 image array (i.e., nrows = 2, ncols = 2), I get the following error:

AttributeError: 'numpy.ndarray' object has no attribute 'matshow'

Why is it hanging up at 2x2 and how to fix this?

Miss_Orchid
  • 308
  • 1
  • 8

0 Answers0