Colormaps appropriate to terrain elevation data
demcmap( sets the colormap and color axis limits
based on the elevation data limits derived from input argument
The default colormap assigns shades of green and brown for positive elevations, and various shades of blue for negative elevation values below sea level.
The number of colors assigned to land and to sea are in proportion to the ranges in terrain elevation and bathymetric depth and total 64 by default. The color axis limits are computed such that the interface between land and sea maps to the zero elevation contour.
The colormap is applied to the current figure and the color axis limits are applied to the current axes.
elevations below and above sea level respectively.
elevations below and above sea level respectively.
Displaying Elevation Data with Default Colormap
Load elevation raster data and a geographic cells reference object. Then, apply a colormap by specifying the maximum and minimum values of the data.
load topo60c axesm hatano meshm(topo60c,topo60cR) zlimits = [min(topo60c(:)) max(topo60c(:))]; demcmap(zlimits) colorbar
Defining Custom Land and Sea Colormaps
Custom RGB colormaps, for example
cmapland, are used to populate figure colormaps by interpolation. The colors in each colormap map to the land and sea regions of the map. Fewer colors have been specified in total than the default number of 64.
demcmap determines maximum and minimum elevation data limits internally as shown in the below example when the first argument is the elevation data grid.
load topo60c axesm hatano meshm(topo60c,topo60cR) cmapsea = [0.8 0 0.8; 0 0 0.8]; cmapland = [0.7 0 0; 0.8 0.8 0; 1 1 0.8 ]; demcmap(topo60c,32,cmapsea,cmapland) colorbar
Colormap in Which Each Color Approximates a User Defined Increment
demcmap example controls the color quantization by choosing an optimal number of colors such that each color represents an elevation increment of approximately 2000 .
load topo60c worldmap('world') geoshow(topo60c,topo60cR,'DisplayType','texturemap') demcmap('inc',[max(topo60c(:)) min(topo60c(:))],2000); colorbar
Z — Terrain elevation limits
vector | matrix
Terrain elevation limits specified as a vector or matrix. If
a 2 element vector, then it specifies the minimum and maximum limits
of terrain elevation data; ordering is not important. If
a matrix, then it specifies an elevation grid in which positive and
negative values represent points above and below sea level respectively.
The above two syntaxes for
demcmap are identical
in their effect on the figure colormap and axes properties.
ncolors — Number of colors in colormap
64 (default) | scalar
Number of colors in the colormap specified as a scalar. It defines
the number of rows
m in the mx3 RGB matrix of the
cmapsea,cmapland — RGB colormap matrices
RGB colormaps specified as mx3 arrays containing any number of rows. The two colormaps need not be equal in length. They serve as the basis set for populating the figure colormap by interpolation.
cmaplandreplace the default colormap. The default colormap for land or sea can be retained by providing an empty matrix in place of either colormap matrix.
That part of the figure colormap assigned to negative elevations
is derived from
a similar role for positive elevations.
deltaz — Increment of elevation
The increment of elevation specified as a scalar. The color
quantization of the default or user supplied colormap is adjusted
such that each discrete color approximately represents a
cmap — RGB colormap
RGB colormap returned as a matrix constructed for the figure
colormap. Supply output arguments when you want to obtain the colormap
and color axis limits without applying them automatically to the figure
or axes properties. These properties remain unchanged even if only
one output (
cmap) is specified.
climits — Color axis limits
Color axis limits returned as a vector.
differ somewhat from those derived from input argument
to the quantization which results from fitting a limited number of
colors over the range limit of the elevation data.
Supply output arguments when you want to obtain the colormap and color axis limits without applying them automatically to the figure or axes.
If the elevation grid data contains both positive and negative
values, then the computed colormap,
cmap, has a
“sea” partition of length
"land" partition of length
nland. The sum of
the total number of entries in the computed colormap. The actual
upon the number of entries and the relative range of the negative
and positive limits of the elevation data. The sea partition consists
of rows 1 through
nsea, and the land partition
consists of rows
nsea + 1 through
The sea and land partitions of the figure colormap are populated with
colors interpolated from the basis RGB colormaps,
In the figure below, the sea and land 3x3 RGB colormaps shown are
the default colors used by
demcmap to populate
the figure colormap when no user specified colormaps are provided.
If the elevation grid data contains only positive or negative values, then the figure colormap is derived solely from the corresponding sea or land colormap.
Introduced before R2006a