Colored Surface Shaded Relief

The functions meshlsrm and surflsrm display maps as shaded relief with surface coloring as well as light source shading. You can think of them as extensions to surflm that combine surface coloring and surface light shading. Use meshlsrm to display regular data grids and surflsrm to render geolocated data grids.

These two functions construct a new colormap and associated CData matrix that uses grayscales to lighten or darken a matrix component based on its calculated surface normal to a light source. While there are no analogous MATLAB® display functions that work like this, you can obtain similar results using MATLAB light objects, as Relief Mapping with Light Objects explains.

For further information, see the reference pages for surflsrm, meshlsrm, daspectm, and view.

Create Colored Shaded Relief Map

Display surface illumination over colored elevation data using surflsrm. First, load elevation data and a geographic cells reference object for the Korean peninsula. Georeference the regular data grid using meshgrat.

load korea5c
[klat,klon] = meshgrat(korea5c,korea5cR);

Create a colormap appropriate for elevation data. Plot the colored shaded relief map by specifying a light source with an azimuth of -130º and an altitude of 50º. The surflsrm function transforms the colormap to shade relief according to the light source. Eliminate white space around the map using tightmap.

[cmap,clim] = demcmap(korea5c);
axesm('miller','MapLatLimit',[30 45],'MapLonLimit',[115 135])
surflsrm(klat,klon,korea5c,[-130 50],cmap,clim)

You can achieve the same effect using meshlsrm, which operates on regular data grids.

The surface has more contrast than if it were not shaded. Lighten the surface uniformly by 25%.


Display an oblique view of the surface. Hide the bounding box by setting the Box property, exaggerate terrain relief by a factor of 50 using daspectm, and set the view to an azimuth of -30º and an altitude of 30º.


You can continue rotating the perspective using view or the Rotate 3D tool in the figure window. You can continue changing the vertical exaggeration using daspectm. To change the built-in lighting direction, you must generate a new view using surflsrm.