Coyote's Guide to IDL Programming

Shading a Surface According to Elevation

QUESTION: Can I shade my surface plot according to its elevation?

ANSWER: Yes. Use the SHADE_SURF command and the SHADES keyword. (If you want a wire mesh surface instead of a light-source shaded surface, use the SURFACE command instead of SHADE_SURF.) The argument to the SHADES keyword will be the original data byte scaled into the number of colors you want to use. For example, your code will look something like this:

   SHADE_SURF, data, Shades=BYTSCL(data, Top=!D/N_Colors-1)

Here is an example of a shaded surface plot in which the shading is by elevation.

Surface shaded with its own elevation. (9K)

[Return to IDL Programming Tips]