I want to plot a 3D tensor plane by plane using matplotlib
in a loop.
However, in this example, matplotlib
keeps on adding colorbars to the figure:
data = np.random.rand(100,100,10)
for i in range(10):
plt.imshow(np.squeeze(data[:, :, i]))
plt.colorbar()
plt.pause(2)
print(i)
Caveat: I've seen some complicated answers to this simple question, which didn't work. The problem may sound simple, but I'm thinking there might be an easy (short) solution.