Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Colormaps appropriate to terrain elevation data

`demcmap(Z)`

`demcmap(Z,ncolors)`

`demcmap(Z,ncolors,cmapsea,cmapland)`

`demcmap('inc',Z,deltaz)`

`demcmap('inc',Z,deltaz,cmapsea,cmapland)`

```
[cmap,climits]
= demcmap(___)
```

`demcmap(`

sets the
colormap and color axis limits based on the elevation data limits
derived from input argument`Z`

)`Z`

.

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.

`demcmap(`

assigns `Z`

,`ncolors`

,`cmapsea,cmapland`

)`cmapsea`

and `cmapland`

to
elevations below and above sea level respectively.

`demcmap('inc',`

assigns `Z`

,`deltaz`

,`cmapsea,cmapland`

)`cmapsea`

and `cmapland`

to
elevations below and above sea level respectively.

If the elevation grid data contains both positive and negative
values, then the computed colormap, `cmap`

, has a
“sea” partition of length `nsea`

and
"land" partition of length `nland`

. The sum of `nsea`

and `nland`

equals
the total number of entries in the computed colormap. The actual
values of `nsea`

and `nland`

depend
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 `ncolors`

.
The sea and land partitions of the figure colormap are populated with
colors interpolated from the basis RGB colormaps, `cmapsea`

and `cmapland`

.
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.