Re: Forcing the Contour Colors to span but always start with the first color

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Jul 12 2013 - 16:05:24 MDT

On Jul 12, 2013, at 11:01 AM, Craig Tierney - NOAA Affiliate <> wrote:

> In my contour map, I am setting using ManualLevels to specify how I want the levels to be set.
> res@cnLevelSelectionMode = "ManualLevels"
> res@cnMinLevelValF = 0.
> res@cnMAxLevelValF = 10.0
> res@cnLevelSpacing = 0.5
> I set my colormap as:
> gsn_define_colormap(xwks,"precip3_16lev")
> I am not very picky about the map I use, but I am plotting differences and I want the first color to always be white.
> It seems my problem is that when NCL (v. 6.1.2) spans colors, it picks another color than the first on in the colormap. While the docs say I can use cnSpanFillPalette=False, then my colors do not stretch across the whole colormap.
> Is there anyway to get the first value to be the first color in the colormap and span the colormap?

Hi Craig,

The first two colors in a color map (color indexes 0 and 1) are the background and foreground colors, and hence are not used for contouring. The spanning always starts at color index 2.

You can try a couple of different things:

 1. Tell the spanning algorithm to start at color index 0 by setting:

res@gsnSpreadColorStart = 0

2. Use a color table whose second color is white, like "wh-bl-gr-ye-re", or "WhiteBlueGreenYellowRed". You can do this via gsn_define_colormap, or, the newer way via "cnFillPalette":

  res@cnFillPalette = "WhiteBlueGreenYellowRed"


> Thanks,
> Craig
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Fri Jul 12 16:05:33 2013

This archive was generated by hypermail 2.1.8 : Fri Jul 12 2013 - 16:37:39 MDT