DEM: Shaded relief image plot (digital elevation model)

Pretty shaded relief map as flat image.
5.4K Downloads
Updated 20 May 2019

View License

This function plots regular grids of elevation X,Y,Z in a more efficient manner than SURFL Matlab's function, because it recomputes lighting and displays result as shaded color flat RGB image. It uses also median-style filter to deal with min/max values of elevations and gradient, and proposes two specific colormaps "landcolor" and "seacolor".
Color mapping and lighting parameters can be changed from default values. In addition, several options are available: 'cartesian' to add decimal axis, 'latlon' to add geographical axis (GMT-like), 'legend' for an automatic scaling legend, 'lake' for automatic flat area color-filling and 'interp' to fill the novalue gaps...
This may be useful to produce high-quality and moderate-size Postscript image adapted for publication. Also, the output image is not dependant on current figure colormap, thus additional plots with indexed colors can be added (contour, pcolor, ...).
Figure examples:
Moon North Pole using the bone colormap and high contrast lighting (DEM source: raster LRO/LOLA LTVT)
Indonesia archipelago using default colormaps, 'latlon' axis basemap and legend scales (DEM source: raster NOAA/NGDC ETOPO1)

Soufrière of Guadeloupe volcano lava dome: 1-m resolution with NaN values (DEM source: OVSG-IPGP/SCIAC)

See "doc dem" for syntax, examples and help. See also the READHGT function from same author.

Cite As

François Beauducel (2024). DEM: Shaded relief image plot (digital elevation model) (https://www.mathworks.com/matlabcentral/fileexchange/36380-dem-shaded-relief-image-plot-digital-elevation-model), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: shadem

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
2.6.0.0

- improves the colormap splitting between land and sea
- new option 'lakezmin' to limit lake detection

2.2.0.0

- new option 'position' for tick labels
- major update thanks to mas Wiwit

2.1.0.0

minor fix

2.0.0.0

legend scale is now liberated from the figure colormap (thanks to Tomke Froechtenich's comment). No use of freezecolors needed to add other colormap plots.

1.10.0.0

improve backward compatibility (strjoijn)

1.9.0.0

- new options: 'km', 'watermark', 'fontsize', 'bordersize'
- improve legend colorbar
- all options now passed as param/value

1.8.0.0

- improved light rendering (using surface normals instead of gradient)
- improved 'lake' detection algorithm
- new 'nancolor' option to set NaN color
- adds a length scale with 'dec' option
- minor code improvements

1.7.0.0

- adds 'interp' option (fill the gaps)
- adds 'seacolor' colormap for negative elevations (bathymetry)

1.6.0.0

- adds a 'lake' option
- minor bug correction

1.5.0.0

now accepts row/column vectors for X and/or Y.

1.4.0.0

- adds basemap-style axis in decimal or lat/lon modes
- adds elevation and distance scales

1.3.0.0

- new landcolor.m colormap function
- new arguments to control colormap scaling
- median-style filters for light and colormap

1.2.0.0

ZIP now contains landcolor.dat companion file.

1.1.0.0

Optimizations: adds a decimation for large DEM grids.

1.0.0.0