PyNGL Home > Functions > Color routines

Ngl.read_colormap_file

Reads the given color map and returns an array of RGBA tuples.

Available in version 1.5.0 or later.

Prototype

rgba = Ngl.read_colormap_file(colormap_name)

Arguments

colormap_name

The name of the predefined PyNGL color map, i.e. "rainbow".

Description

This is a convenience function for loading any one of PyNGL's system color maps. Its primary use-case is loading and possibly subsetting color maps that are then assigned to resources such as cnFillPalette, cnFillColors, vcLevelPalette, vcLevelColors, stLevelColors, or stLevelPalette.

Note that the function always returns 4-component colors, consisting of red/green/blue/opacity values. If the source color tables do not contain opacity values, a default of 1.0 (opaque) is returned.

Examples

See any one of the following examples: