objectif
Afficher une matrice comme carte de chaleur.
code minimal
import matplotlib.pyplot as plt
import numpy as np
plt.imshow(np.arange(9).reshape(3,3))
plt.colorbar()
print("ok")
utilisation
import numpy as np
print(np.arange(9).reshape(3,3).shape)
variante(s) utile(s)
import matplotlib.pyplot as plt
plt.figure(); plt.imshow([[1,2],[3,4]], aspect="auto")
print("ok")
notes
- Normaliser ou choisir cmap pertinent pour perception.