Colormaps translate 1D numerical data into continuous color spectra. Perceptually uniform colormaps (like `viridis` and `cividis`) ensure that equal data differences look equally distinct to human vision and remain legible in black-and-white or for color-blind readers.
A rainbow thermometer where heat directly corresponds to color temperature.
1. Sequential (`viridis`, `Blues`): values from low to high. 2. Diverging (`coolwarm`, `seismic`): critical midpoint with extremes on both ends. 3. Qualitative (`tab10`, `Set2`): categorical groups.
plt.imshow(matrix, cmap='coolwarm')Avoid the top errors and bad plotting practices that trip up new Python developers
Switch from abstract numbers to relatable Cricket, Cinema & Business charts
Write Matplotlib code to solve the objective and see your live plot render
Display a 2D matrix using `plt.imshow([[1, 2], [3, 4]], cmap='plasma')` and add a `plt.colorbar()`.
✓ plt.imshow✓ plt.colorbarTest your understanding to unlock the lesson completion badge