Re: Urgent HELP: Unwanted color shows in color map

From: Yemi! <adadebiyi_at_nyahnyahspammersnyahnyah>
Date: Thu Nov 29 2012 - 06:34:34 MST

Hello,

Thanks for your quick reply.

No it did not work. I think you can't define gsnSpreadXXXX with
cnFillColors. It gave this error message when I tried it.
spread_colors: warning: you are setting both cnFillColors and

(0) gsnSpreadColors. Your cnFillColors resource will

(0) be ignored. If this is not desired, delete the

(0) setting of gsnSpreadColors or set it to False.

I really don't know what I am doing wrong! Any further help will be
appreciated.

Yemi

On 11/29/12 8:23 AM, David Jones wrote:
> Maybe you could try adding a line like
>
> res@gsnSpreadColorEnd = -1
>
> I think this would remove the last color from the color bar, with -2
> removing the last 2 colors etc. I sometimes noticed that when you
> select a, for example, what appears to be an 18 level color bar that
> some additional white levels get added at the end.
> Not sure if this will work though, so if it works then reply to the
> list to say so.
>
> Dave.
>
> ------------------------------------------------------------------------
> *From:* Yemi! <adadebiyi@gmail.com>
> *To:* ncl-talk@ucar.edu
> *Sent:* Thursday, November 29, 2012 2:13:03 PM
> *Subject:* [ncl-talk] Urgent HELP: Unwanted color shows in color map
>
> Hello Everybody,
>
> I have been trying to work around this problem for some days and I
> will really appreciate any help I can get.
>
> In my code(see below), I want to be able to specify the fill colors
> myself by defining the res@cnFillColors, so I retrieved the cnLevels
> and use it to redefined the res@cnFillColors. What happened is that
> during this process, an extra color is added to the top of the
> color-table which I did not specify(and dont want either). I just want
> to define different color for negative and positive so that zero
> contour can be white.
>
> How can I get rid of this? Please help, it's urgent
>
> See part of the code and example plot attached.
>
> begin
> .....
> ..
> wks = gsn_open_wks ("pdf", "anom")
> gsn_define_colormap(wks,"ViBlGrWhYeOrRe") ;choose color map
> res = True ; plot mods desired
> res@gsnFrame = False
> res@gsnDraw = False
>
> res@cnFillOn = True ; turn on color for contours
> res@cnLinesOn = False ; turn off contour lines
> res@cnLineLabelsOn = False ; turn off contour line
> labels
> res@gsnAddCyclic = False
>
> i = NhlNewColor(wks,0.7,0.7,0.7) ; add gray to colormap
> res@mpLandFillColor = "gray" ; set land to be gray
> res@mpFillOn = True ; turn off gray map
> res@mpOutlineDrawOrder = "PostDraw" ; draw outline first
> res@mpGeophysicalLineThicknessF = 2.0
>
> res@mpMinLonF = areaw ; select a subregion
> res@mpMaxLonF = areae
> res@mpMinLatF = areas
> res@mpMaxLatF = arean
>
> res@lbOrientation = "Vertical" ; vertical label bar
> res@pmLabelBarOrthogonalPosF = -0.01 ; move label bar closer
> res@lbLabelStride = 4
>
> plot = gsn_csm_contour_map_ce(wks,varr,res) ; create plot
> getvalues plot@contour
> "cnMinLevelValF" : res@cnMinLevelValF
> "cnMaxLevelValF" : res@cnMaxLevelValF
> "cnLevelSpacingF" : res@cnLevelSpacingF
> "cnLevels" : levels
> end getvalues
> res@cnLevelSelectionMode = "ManualLevels"
> res@cnLevelSpacingF = (res@cnLevelSpacingF)/2.0
> ;---Create array containing fill indexes.
> nlevels = dimsizes(levels)*2
> colors = new(nlevels-1,integer)
> levv = fspan(levels(0),levels(dimsizes(levels)-1),nlevels-1)
> ii = ind(levv.ge.0)
> num_neg = ii(0)
> num_pos = nlevels-num_neg-1
> colors(0:num_neg-1) = toint(fspan(2,44,num_neg))
> colors(num_neg:) = toint(fspan(56,101,num_pos))
>
> res@cnLevels= levv
> res@cnFillColors= colors
>
> plot(0) = gsn_csm_contour_map_ce(wks,varr,res) ; create plot
>
> ......
> ...
> end
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Nov 29 06:34:46 2012

This archive was generated by hypermail 2.1.8 : Fri Dec 07 2012 - 13:30:06 MST