Re: Color Bar

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri May 13 2011 - 14:10:02 MDT

Hi Erick,
You are using gsnSpreadColors, which automatically selects the colors
used in your plot starting with the 2nd color (after
background/foreground colors), evenly striding across your colormap, and
ending with the last color in your colormap. (As you know, you can alter
the starting and ending color by setting gsnSpreadColorStart and/or
gsnSpreadColorEnd.)

When you increase the number of contour levels, the only thing that
changes with respect to how gsnSpreadColors operates is it reduces the
stride between colors. Thus, the starting and ending colors will remain
the same, but the colors between the starting and ending colors will
likely change.

The great thing about using gsnSpreadColors is that it is automatic. The
bad thing about it is that it is automatic, and you have limited control
of exactly which color index you want to use for a specific contour
range. Thus, I think your best bet is to explicitly set the colors that
you want, and to stop using gsnSpreadColors. To do that you need to set
cnFillColors while taking a look at the webpage that shows the colormap
you are using.

I'll take a guess that you are using the wh-bl-gr-ye-re colormap:
http://www.ncl.ucar.edu/Document/Graphics/ColorTables/wh-bl-gr-ye-re.shtml

In that case I'd try setting my colors like this:
res@cnFillColors = (/0,0,10,25,50,75,100,125,150,175,200/) ; 0 = white

Hope that all makes sense...
Adam

On 05/13/2011 01:42 PM, Erick Rivera Lemus wrote:
> Dear NCL users,
> I am having difficulties trying to arrange the color bar on the
> following plot. I want the plot to look like the test.Auto_levels.png
> figure (see attachment), however I want to adjust the bar to start from
> 0 to 100. When I set the cnLevelSlectionMode to Manual level and select
> the contour spacing I get the test.Manual_levels.png (see attachment)
> figure and for some reason the colors change. This is what I have as my
> settings (see attach). I think I am missing something, but I can not
> figure out what seems to be the problem if it is on the label bar or
> with the colors. Not sure. Let me know if you have any suggestions. Thanks.
>
> res = True ; plot mods desired
> ; Contour lines settings
> res@cnFillOn = True ; turn on color
> res@cnLinesOn = False ; no contour lines
>
> res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
> res@cnMinLevelValF = 0. ; set min contour level
> res@cnMaxLevelValF = 100. ; set max contour level
> res@cnLevelSpacingF = 10. ; contour spacing
>
> res@gsnSpreadColors = True ; use full color map
> res@gsnSpreadColorStart = 0
> res@gsnSpreadColorEnd = -2 ; don't use added gray
> res@lbOrientation ="vertical" ; vertical label bar
> res@lbLabelAutoStride = True ; every other label
>
> ; Map settings
> ;This will start Zooming into the MAB and creating a Mercator Projection
>
> res@mpProjection = "mercator" ; projection
> res@mpLimitMode = "Corners" ; method to zoom
> res@mpLeftCornerLatF = minLat;min(lat)
> res@mpLeftCornerLonF = minLon;min(lon)
> res@mpRightCornerLatF = maxLat;max(lat)
> res@mpRightCornerLonF = maxLon;max(lon)
>
> res@cnFillDrawOrder = "PreDraw" ; fill first
>
> res@gsnAddCyclic = False;
> res@mpLandFillColor = "gray"; Map fill color is gray
> res@mpOutlineOn = True; Draw map outline
> res@mpDataBaseVersion = "HighRes"; Medium resolution map
>
> res@mpDataBaseVersion = "HighRes" ; use MAB High Resolution
> res@pmTickMarkDisplayMode = "Always" ; turn on tickmarks
> res@mpFillDrawOrder = "Draw"
>
> ; Turn on map grid
> res@mpGridAndLimbOn = True;
> ; Set gridline intervals
> res@mpGridSpacingF = 0.5; ; 1/2 degree intervals
> res@mpGridLineDashPattern = 2; ; dashed line
> res@mpGridLineThicknessF = 0.5;
>
>
>
> Cheers,
> Erick Rafael Rivera Lemus
> Software Technician
> Institute of Marine and Coastal Sciences
> Coastal Ocean Observation Laboratory
>
> Rutgers, The State University of New Jersey
> 71 Dudley Road New Brunswick, NJ 08901 Phone: 732-932-6555 ext. 503
> Fax: 732-932-1821
> Cell: 617-447-5106
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
__________________________________________________
Adam Phillips 
asphilli@ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
Climate and Global Dynamics Division         fax: (303) 497-1333
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 Fri May 13 14:10:12 2011

This archive was generated by hypermail 2.1.8 : Tue May 17 2011 - 15:11:28 MDT