Re: colors doesn't change

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Sun Aug 28 2011 - 21:29:00 MDT

Dear Hongyan,

There's not enough information to go on here. It would help if you
could provide the full script, or even the image.

Are you getting any error messages when you run your script?

Do you have res@gsnSpreadColors = True somewhere in your code? If you
do, then this is probably the source of the problem and you should
comment this line out.

Using the resource settings you listed below, I ran a small test
program, and got the results expected: a color contour plot that
starts with color white in the labelbar, and then spans yellow-orange-
red-purple.

Here's the code:

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

begin
;---Generate some dummy data.
   nlat = 50
   nlon = 100
   data = generate_2d_array(10, 10, 3.8, 32.5, 0, (/nlat,nlon/))
   data!0 = "lat"
   data!1 = "lon"
   lat = fspan(-90,90,nlat)
   lon = fspan(-175,175,nlon)
   lat@units = "degrees_north"
   lon@units = "degrees_east"
   data&lat = lat
   data&lon = lon

   wks = gsn_open_wks("x11","opacity")
   gsn_define_colormap(wks,"BlAqGrYeOrReVi200")

   res = True
   res@mpFillOn = False
   res@mpOutlineOn = True
   res@cnFillOn = True
   res@cnLinesOn = False
   res@cnLevelSelectionMode = "ExplicitLevels"
   res@cnLineLabelsOn = False
   res@cnLevels = (/ 4,8,12,16,20,24,28,32 /)
   res@cnFillColors = (/ 0,110,120,130,140,150,160,170,180,190 /)
   plot = gsn_csm_contour_map(wks,data,res)

end

On Aug 28, 2011, at 8:00 PM, H.Dang wrote:

> Hi dear all,
>
> In one of my plots, no matter how I set the cnFillColors, the filled
> colors in the final plot doesn't change, looks like NCL chooses some
> color in the color_table automatically. My code is:
>
> gsn_define_colormap(wks,"BlAqGrYeOrReVi200")
> res = True
> res@mpFillOn =
> False ; turn map fill
> off
> res@mpOutlineOn =
> True ; turn the map
> outline on
> res@cnFillOn =
> True ; turn on color
> fill
> res@cnLinesOn =
> False ; turn off the
> contour lines
> res@cnLevelSelectionMode =
> "ExplicitLevels" ; set explicit contour
> levels
> res@cnLineLabelsOn =
> False ; turn the line
> labels off
> ;res@cnLevels = (/ 4,8,12,16,20,24,28,32,36 /) ; set levels
> ;res@cnFillColors = (/ 100,110,120,130,140,150,160,170,180,190 /) ;
> set the colors to be used
> res@cnLevels = (/ 4,8,12,16,20,24,28,32 /) ; set levels
> res@cnFillColors = (/ 0,110,120,130,140,150,160,170,180,190 /) ;
> set the colors to be used
>
> The colors are not what I set in res@cnFillColors at all. Any
> suggestons are appreciated.
>
> --
> Cordially,
> Hongyan(鸿雁)
> Tel: 1-519-8884567ext36667
>
>
> _______________________________________________
> 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 Sun Aug 28 21:29:19 2011

This archive was generated by hypermail 2.1.8 : Mon Aug 29 2011 - 21:44:22 MDT