
NCL > Application examples > Basic examples
Basic example 5
How to manipulate a colormap
This is an introductory example that shows how to manipulate colormaps using HLU C, HLU FORTRAN library calls, and NCL. The example demonstrates how to change color tables, how to alter a colormap entry, and how to create a completely new colormap. The names of the example codes that create this plot are basic05n.ncl, basic05c.c, and basic05f.f.

Discussion
This module demonstrates how to assign one of the predefined colormaps to
a workstation object and then draw a labelbar that displays the current
colormap. This example displays each of the NCAR Graphics pre-defined
colormaps in a single frame. The example also shows how to read a
colormap array, alter
entries in that array, and then reassign the colormap. Finally, this
example demonstrates how to create a completely new colormap array and
then apply it to a workstation object.
A detailed discussion about how to create the plots appears in the comments of the source code for the example.
Creating the plot using HLU C library calls
The HLU C program that generates this plot is called basic05c.c.
Creating the plot using HLU FORTRAN library calls
The HLU FORTRAN program that generates this plot is called basic05f.f.
Creating the plot using NCL
The HLU NCL program that generates this plot is called basic05n.ncl.
The data
No external data is used with this example.How to run this example
The examples are installed in the following locations:
- $NCARG_ROOT/lib/ncarg/nclex/basic/basic05n.ncl
- $NCARG_ROOT/lib/ncarg/hluex/basic/basic05c.c
- $NCARG_ROOT/lib/ncarg/hluex/basic/basic05f.f