This example shows how to change the colors used in a filled contour plot.
Set the colors for the filled contour plot by changing the colormap. Pass the predefined colormap name,hot
, to thecolormap
function.
[X,Y,Z] = peaks; figure contourf(X,Y,Z,20) colormap(hot) title('Hot Colormap')
Use only the colors in the center of thehot
colormap by setting the color axis scaling to a range much larger than the range of values in matrixZ
. Thecaxis
function controls the mapping of data values into the colormap. Use this function to set the color axis scaling.
caxis([-20,20]) title('Center of Hot Colormap')