Back to Data Visualization
colormap
Set or get colormap for current figure
Syntax
colormap(name) colormap(map) cmap = colormap
Description
Sets the colormap used for pseudocolor plots like imagesc, mesh, and surf. With no arguments, returns the current colormap as an Mx3 RGB matrix (default 256 rows). With a string argument, sets to a named colormap. With an Mx3 matrix argument, sets a custom colormap where each row is [R G B] with values in range [0,1].
Parameters
| Name | Description |
|---|---|
| name(optional) | Colormap name: viridis (default), jet, hot, cool, gray, grayscale, parula, turbo, coolwarm, rainbow, bone, copper, spring, summer, autumn, winter |
| map(optional) | Mx3 matrix of RGB values (each in [0,1]) |
Returns
Mx3 RGB matrix (query mode) or null (set mode)