NCL Home>
Application examples>
Plot techniques ||
Data files for some examples
Example pages containing:
tidbits |
resources |
functions/procedures
Color Maps
This suite of examples shows how to change, create, draw, reverse, and
otherwise manipulate color maps (also known as "color tables").
NCL has a built-in list of available color tables and a
suite of 650 named
colors you can use.
If you need to use CMYK color, then you can set this via a
workstation resource, before
you call gsn_open_wks:
type = "ps"
type@wkColorModel = "cmyk"
wks = gsn_open_wks(type,"example")
colormap_4.ncl: Demonstrates
merging two colormaps
using
gsn_merge_colormaps. You can only do this
with two colormaps whose sum total is fewer than 256 colors.
Note that the background/foreground colors are retained from the
first colormap only.
colormap_5.ncl: Demonstrates
adding colors to an existing colormap, using
NhlNewColor. This is useful if you specifically
need to use one or more
named colors and they
are not in your current color map.
In order to add named colors to a colormap, you need to get their
corresponding RGB triplet from the $NCARG_ROOT/lib/ncarg/database/rgb.txt
file. This will be in values from 0 to 255, so you first need to
divide the values by 255 to get an RGB triplet.
colormap_6.ncl: Uses
hsvrgb to draw some illustrative
HSV color wheels.
See the next example for how to create a colormap using this function.
colormap_7.ncl: Uses values
from the above HSV color wheels to generate colormaps than span
from one color to another.
The colormap is drawn using gsn_labelbar_ndc.