Re: using named colors

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu, 20 Apr 2006 07:33:50 -0600

Hi Marjolaine,

In order to use named colors, they actually have to be in your color
map. In
the gsn_draw_named_colors procedure, it is taking the list of name
colors and loading
them into a colormap before it draws them.

You can load them directly using gsn_define_colormap:

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"

begin
   wks = gsn_open_wks("x11","color")

   colors = (/"white", "black", "PeachPuff", "MintCream", "SlateBlue", \
              "Khaki", "OliveDrab","BurlyWood", "LightSalmon", "Coral", \
              "HotPink", "LemonChiffon", "AliceBlue", "LightGrey", \
              "MediumTurquoise", "DarkSeaGreen", "Peru", "Tomato", \
              "Orchid","PapayaWhip"/)

   gsn_define_colormap(wks,colors)
   gsn_draw_colormap(wks) ; draw current colormap
end

If you already have a color map that you need to use, and you just need
to add
these colors, you can do it with gsn_merge_colormaps:

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"

begin
   wks = gsn_open_wks("x11","color")

   colors = (/"white", "black", "PeachPuff", "MintCream", "SlateBlue", \
              "Khaki", "OliveDrab","BurlyWood", "LightSalmon", "Coral", \
              "HotPink", "LemonChiffon", "AliceBlue", "LightGrey", \
              "MediumTurquoise", "DarkSeaGreen", "Peru", "Tomato", \
              "Orchid","PapayaWhip"/)

   gsn_merge_colormaps(wks,"rainbow",colors)
   gsn_draw_colormap(wks) ; draw current colormap
end

When using gsn_merge_colormaps, the second two arguments can be
predefined
colormap names (like "rainbow" or "BlWhRe"), an array of RGB triplets,
or a list
of named colors.

--Mary

On Apr 20, 2006, at 5:45 AM, Marjolaine Rouault wrote:

> Hi,
>
> I am trying to generate a map with my own colors for the land and
> ocean fills.
> I am using named colors from the NCL color database. When using the
> ncl script
> color_17.ncl (from the NCL Home> Application examples> Plot techniques
> section), all my colors come out perfectly as they should.
>
> However, when using the same colors in my own script, the colors change
> completely. For example, PeachPuff becomes yellow and BurlyWood
> becomes grey.
>
> Can anyone help?
>
> Marjolaine Rouault
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Apr 20 2006 - 07:33:50 MDT

This archive was generated by hypermail 2.2.0 : Thu Apr 20 2006 - 09:30:38 MDT