Re: color fill and contour colors

From: Adam Phillips (asphilli AT XXXXXX)
Date: Fri Feb 28 2003 - 14:44:25 MST

  • Next message: Hilde Fagerli: "Irregular X-axis in xy plot"

    > My goal is to shade a contour plot with everything < 0 a light gray, but draw
    several more contours that are all in black. It seems I can't figure out how to
    do this. Any suggestions would be useful. I have:

    Josh,

    Try using these resources:

    gsn_define_colormap(wks,(/"white","light gray","black"/))
    plotres@cnFillOn= True
    plotres@cnLevelSelectionMode = "ManualLevels"
    plotres@cnMinLevelValF = -10.
    plotres@cnMaxLevelValF = 10.
    plotres@cnLevelSpacingF = 0.1
    plotres@cnMonoLineColor = False
    cnarray = new((/201/),"integer")
    cnarray(:99) = -1 ;make all contours < 0 transparent
    cnarray(100:) = 2 ;make all contous >= 0 black
    plotres@cnLineColors = cnarray
    fillarr = cnarray
    fillarr(:99) = 1 ;Gray fill everything < 0
    fillarr(100:) = -1 ;Don't fill anything > 0
    plotres@cnFillColors = fillarr
    plot(0)=gsn_contour(wks,profs_T,plotres)

    I didn't test this, so my color assignments might not be right, but hopefully
    you get the idea... Another partial solution is to use a shea_util.ncl resource
    called ColorShadeLeGeContour to fill everything below 0 gray, but you would
    still need to use the line color resources above...

    Adam

    >
    > plotres@cnFillOn = True
    > gsn_define_colormap(wks,(/"white","light gray"/))
    > plotres@gsnSpreadColors = True
    > plotres@gsnSpreadColorStart = 1
    > plotres@gsnSpreadColorEnd = 0
    > plotres@cnMonoLineColor = True
    > plotres@cnLineColor = "black"
    > plotres@cnLevelSelectionMode = "ManualLevels"
    > plotres@cnMinLevelValF = -10.
    > plotres@cnMaxLevelValF = 10.
    > plotres@cnLevelSpacingF = 0.1
    > plot(0)=gsn_contour(wks,profs_T,plotres)
    >
    > I get the correct shading, but the contours and plot boundaries are also light
    gray.
    >
    > Cheers,
    > Josh
    >
    >
    > --
    > Joshua Hacker
    > Advanced Studies Program
    > NCAR/UCAR
    > email: hacker AT ucar.edu
    > voice: 303-497-8188
    > fax: 303-497-8171
    >
    > _______________________________________________
    > ncl-talk mailing list
    > ncl-talk AT ucar.edu
    > http://mailman.ucar.edu/mailman/listinfo/ncl-talk

    -------------------------------------------------------------
    Adam Phillips email: asphilli AT ucar.edu
    Climate and Global Dynamics Division tel: (303) 497-1726
    National Center for Atmospheric Research fax: (303) 497-1333
    P.O. Box 3000
    Boulder, CO 80307-3000 http://www.cgd.ucar.edu/~asphilli

    _______________________________________________
    ncl-talk mailing list
    ncl-talk AT ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Fri Feb 28 2003 - 14:52:53 MST