Adds the given color to the end of the color map of the given workstation.
index = Ngl.new_color(wks, red, green, blue)
The identifier returned from calling Ngl.open_wks.red, green, blue
Floating point values between 0.0 and 1.0 inclusive.
An integer representing a color index into the current colormap that contains the new color added.
For the given workstation, this function adds the given color (represented by an RGB triplet) to the end of the color map associated with the given workstation. What's returned is the index value of the location of the new color in the color map.
If the color map you are trying to add the new color to already contains the maximum number of colors (256), then you will get a fatal error message, and the returned value will be invalid.
This function is different than the Ngl.set_color procedure in that you are not required to input a color index value for where to put the new color.
See scatter2.py, or, for a simpler example, run the following Python script:
import Ngl wks = Ngl.open_wks("x11","example") # # Draw the current color map. # Ngl.draw_colormap(wks) # # Add three shades of blue to the end of the colormap. # i1 = Ngl.new_color(wks,0.,0.,0.75) i2 = Ngl.new_color(wks,0.,0.,0.50) i3 = Ngl.new_color(wks,0.,0.,0.25) # # Draw the new current color map; it should have three extra shades # of blue at the end. # Ngl.draw_colormap(wks) Ngl.end()