Re: retrieve named colors

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Thu Sep 22 2011 - 10:05:39 MDT

Hi Jimmy,
The numbers are directly associated with the colormap. I see that you
are merging your colors array with the radar color map. In that case,
your colors will map like this:
0 = white
1 = black
2 = white
3 = blue
4 = first color in radar colormap, = "light blue"
5 = second color in radar colormap, = "medium blue"
....
18 = 2nd to last color in radar colormap, = light purple
19 = last color in radar colormap, = white
http://www.ncl.ucar.edu/Document/Graphics/ColorTables/radar.shtml

Looking at the documentation of cnLineColors:
http://www.ncl.ucar.edu/Document/Graphics/Resources/cn.shtml#cnLineColors

you also need to set cnMonoLineColor = False if you're coloring each
contour differently.

for example:

colors=(/"white","black","white","blue"/)
gsn_merge_colormaps(wks,colors,"radar")
<snip>
res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels = ispan(1,5,1)
res@cnMonoLineColor = False
res@cnLineColors = (/4,11,12,13,14/) ; color your contours light
                                      ; blue, green,yellow,orange,red
Adam

On 09/22/2011 09:38 AM, James Correia wrote:
> Hi Saji-
> I didn't have any luck with that resource.
>
> In the example, the colors are specified with numbers. Are those numbers
> directly associated with the colors from the colormap (eg Where 0 is the
> first color in that colormap, or does it refer to the color "0"?)
>
> jimmyc
>
>
> On Wed, Sep 21, 2011 at 3:16 PM, Saji Hameed <saji.nh@gmail.com
> <mailto:saji.nh@gmail.com>> wrote:
>
> Hi James,
>
> You should use cnLineColors
> http://www.ncl.ucar.edu/Document/Graphics/Resources/cn.shtml#cnFillColors
>
> See the example below that explicitly assigns color levels for each
> contour.
> http://www.ncl.ucar.edu/Applications/Scripts/conLev_3.ncl
>
> saji
>
> On Thu, Sep 22, 2011 at 4:35 AM, James Correia <jimmyc42@gmail.com
> <mailto:jimmyc42@gmail.com>> wrote:
> > Hi-
> > I am trying to use the existing colors in my colormap to color
> specific
> > contours in my contour plot. How do I assign the value for col(q)
> in the
> > example below? Or should I be using the gsnSpreadColorStart (and
> End) to use
> > the different colors individually for each specific contour?
> >
> > colors=(/"white","black","white","blue"/)
> > gsn_merge_colormaps(wks,colors,"radar")
> >
> > res@cnLineColor = col(q)
> >
> > --
> >
> > James Correia Jr.
> > OU CIMMS Research Associate
> > SPC HWT Liaison
> >
> > "The highest function of the teacher consists not so much in
> imparting
> > knowledge as in stimulating the pupil in its love and pursuit. To
> know how
> > to suggest is the art of teaching."
> >
> >
> ------------------------------------------------------------------------------------------
> > The views expressed in this email do not necessarily reflect
> those of NOAA,
> > the National Weather Service, or the University of Oklahoma.
> >
> ------------------------------------------------------------------------------------------
> >
> >
> > _______________________________________________
> > ncl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >
> >
>
>
>
>
> --
>
> James Correia Jr.
> OU CIMMS Research Associate
> SPC HWT Liaison
>
> "The highest function of the teacher consists not so much in imparting
> knowledge as in stimulating the pupil in its love and pursuit. To know
> how to suggest is the art of teaching."
>
> ------------------------------------------------------------------------------------------
> The views expressed in this email do not necessarily reflect those of
> NOAA, the National Weather Service, or the University of Oklahoma.
> ------------------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Sep 22 12:05:45 2011

This archive was generated by hypermail 2.1.8 : Thu Sep 22 2011 - 17:12:44 MDT