How to plot a 2d matrix in python with colorbar? (like imagesc in Matlab)

import numpy as np
import matplotlib.pyplot as plt

plt.imshow(np.random.random((50,50)))
plt.colorbar()
plt.show()

Leave a Comment