Ngl.merge_colormaps
Merges two color maps to create a new color map for the given workstation.
Available in version 1.2.0 or later.
Prototype
Ngl.merge_colormaps(wks,cmap1,cmap2)
Arguments
wksThe identifier returned from calling Ngl.open_wks.
cmap1, cmap2Predefined color map names and/or NumPy arrays of n x 3 RGB values.
Return value
NoneDescription
This procedure merges two color maps into a single color map and sets it for the given workstation. The background/foreground colors will be retained from the first color map, and dropped from the second one. The two color maps must total 256 or fewer colors.
The color maps can be predefined color map names, or arrays of n x 3 RGB values.
See Also
Ngl.draw_colormap, Ngl.define_colormap, Ngl.retrieve_colormap, Ngl.open_wks, Ngl.draw, Ngl.set_values
Examples
Example 1
For a simple example of using Ngl.merge_colormaps to merge the "temp1" and "uniform" color maps, run the following Python script:
import Ngl wks = Ngl.open_wks("x11","example") Ngl.merge_colormaps(wks,"temp1","uniform") Ngl.draw_colormap(wks) Ngl.end()
Example 2
For an example of merging a predefined color map with a set of RGB values, run the following Python script:
import Ngl,numpy wks = Ngl.open_wks("x11","example") cmap = numpy.array([[0.,0.,0.],[1.,1.,1.],[.1,.1,.1],[.2,.2,.2],[.3,.3,.3]]) Ngl.merge_colormaps(wks,"nrl_sirkes",cmap) Ngl.draw_colormap(wks) Ngl.end()For more examples, run the multi_plot.py script (see frame 1).