Hi Freddie,
To add white to your printed labelbar you have two choices:
1) As white is already part of the colormap (color indices 0 and 8), it
is probably easiest to specify exactly which colors correspond to which
contour intervals.
You can do this by setting cnFillColors (and not setting gsnSpreadColors
= True if you were doing so), using the indices shown here:
www.ncl.ucar.edu/Document/Graphics/ColorTables/precip_diff_12lev.shtml
res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels = (/-.3,-.2,-.1,0,0.1,0.2/)
res@cnFillColors = (/2,4,6,8,8,10,12,14/) ; #s refer to indices
If you wish to change the white to gray, you first have to add gray to
your colormap. The easiest way to do this is to use NhlNewColor after
you open the workstation:
wks = gsn_open_wks("ps",get_script_prefix_name())
gsn_define_colormap(wks,"precip_diff_12lev")
nc1 = NhlNewColor(wks,0.5,0.5,0.5) ; = medium gray
nc2 = NhlNewColor(wks,0.8,0.8,0.8) ; = light gray
Note that in the above medium gray would be added to precip_diff_12lev
as the 15th color index, and light gray would be added as the 16th color
index.
To use the light gray in the middle set
res@cnFillColors = (/2,4,6,16,16,10,12,14/)
2) You can manipulate the loaded color table yourself. I won't go into
details here as option #1 is much easier. But see:
http://www.ncl.ucar.edu/Applications/color.shtml#ex16
example 16 shows how to load a colormap, retrieve it, and modify it.
Hope that helps. If not, let ncl-talk know.
Good luck,
Adam
On 02/22/2012 03:51 PM, Freddie.Mpelasoka@csiro.au wrote:
> Dear ncl experts,
>
> I am learning to produce plots using ncl. How can I manipulate "precip_diff_12lev "color map to have white color around zero (i.e. over [-0.1 and +0.1]) for the range /-0.3, -0.2, -0.1, 0., 0.1,0.2/. I am also wondering if the "white" color in the "precip_diff_12lev "can be replaced with "grey". Your help will be highly appreciated.
>
>
> Many thanks,
>
> Freddie
>
>
> _______________________________________________
> 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 Wed Feb 22 16:23:40 2012
This archive was generated by hypermail 2.1.8 : Thu Feb 23 2012 - 10:01:53 MST