Re: please help with color bar

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Tue Aug 16 2011 - 09:46:36 MDT

Hi Hongyan,
No, there is no automatic way to do this. If you want to use all 200
colors from the BlAqGrYeOrReVi200 colormap, and you want the middle color
(representing -.01:.01) to be white, you will have to set that up
manually:

colors = new(201,integer)
colors(:99) = ispan(2,101,1)
colors(100) = 0 ; or -1 if you truly want transparent
colors(101:) = ispan(102,201,1)
res@cnFillColors = colors

You would also have to set cnLevels explicitly to whatever you'd like.
Finally, if you truly want to use all 200 colors in your labelbar, you're
probably going to want to set lbLabelStride = 10 (or somewhere > 10), as
this will reduce the number of label bar labels to every 10th label...
Hope that helps.. Adam

> Hi dear all,
>
> My current color bar is like the attachment. The NCL code I'm using is:
>
> gsn_define_colormap(wks,"BlAqGrYeOrReVi200")
> res = True
> res@mpFillOn = False ;
> turn map fill off
> res@mpOutlineOn = True ;
> turn the map outline on
> res@cnLevelSelectionMode = "ExplicitLevels" ;
> set explicit contour levels
> res@cnFillOn = True ;
> turn on color fill
> res@cnLinesOn = False ;
> turn off the contour lines
> res@cnLevels = (/ -5., -1, -0.01, 0.01,1, 5, 10, 15.,20, 25, 30, 35,
> 40, 45, 50/) ; set levels
> res@cnFillColors =
> (/2,16,31,0,56,63,75,84,96,106,115,127,139,150,165,175,191,201/) ; set the
> colors to be used
>
> My question is if I can use as many as possible colors, say all the color
> in
> "BlAqGrYeOrReVi200", and keep the -0.01 and 0.01 labels in the color bar,
> the others can be automatically generated. Since the transparent color
> (white) between -0.01~0.01 is very important for me, I must keep them.
> Appreciate your help!
>
> Have a good day.
> --
> Cordially,
> Hongyan(鸿›)
> Tel: 1-519-8884567ext36667
> _______________________________________________
> 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
P.O. Box 3000 (303) 497-1726
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 Tue Aug 16 09:46:42 2011

This archive was generated by hypermail 2.1.8 : Mon Aug 22 2011 - 08:13:37 MDT