import matplotlib.pyplot as plt fig, ax = plt.subplots() m = ax.imshow(X) cbar = plt.colorbar(m) cbar.set_label('X+Y') plt.show()