[ncl-talk] Making zero value white in contour plot

Mary Haley haley at ucar.edu
Wed Oct 5 15:30:04 MDT 2016


Jake,

In NCL, the colors represent the values *between* contour levels and not
exactly equal to a contour level. It's not possible to tell NCL that you
want all values equal to 0 to be white, because you need a range of values
in order to actually have an area that you can fill in a certain color.

Your white value is representing all values >= -5 and < 5.  If you want
this to more closely represent values that are equal to zero, then you need
to provide a smaller range of values, like -0.1 to 0.1. It will depend on
how close your values are to zero.

The other possibility is to portray the 0 contour level a different way.
For example, if you look at example coneff_1.ncl at:

http://www.ncl.ucar.edu/Applications/coneff.shtml#ex1

it uses a special resource "gsnContourZeroLineThicknessF" to make the zero
contour line double thick.  Of course, in order for this to work, you
actually have to have a 0 contour line. For example:

res at cnLevelSpacingF  = 5

res at cnMinLevelValF = -75

res at cnMaxLevelValF = 75

You may also want to visit the "symmetric" contours page at:

http://www.ncl.ucar.edu/Applications/contoursym.shtml

--Mary


On Tue, Oct 4, 2016 at 7:57 PM, Jake Huff <jake.huff at stonybrook.edu> wrote:

> Hello Everyone,
>
> I am currently using gsn_csm_contour_map along with cnFillColors to
> specify which colors I want on the label bar.
>
> For example I am specifiying the minimum, maximum and spacing of values
> for the contour levels.
>
> wks = gsn_open_wks("pdf","example")
> gsn_define_colormap(wks,"BlWhRe")
>
> res = True
>
> res at cnLevelSpacingF  = 10
>
> res at cnMinLevelValF = -75
>
> res at cnMaxLevelValF = 75
>
> res at cnFillColors = (/2,9,13,18,22,28,34,40,0,55,62,70,77,84,90,95,102/)
>
>
> So this makes the contour level from -5 to 5 be white by using value 0 in
> the cnFillColors. The problem I have is that this is misleading because it
> makes a lot of values white instead of just the zero value.
>
>
> My question is how to make a contour plot with a color bar that has the
> zero value be white and all other values be non-white.
>
>
> Thanks,
>
> Jake
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161005/e6aa31dc/attachment.html 


More information about the ncl-talk mailing list