Re: color contour line

From: David Atkinson <datkinson_at_nyahnyahspammersnyahnyah>
Date: Thu, 06 Dec 2007 11:57:15 -0900

Or you can just modify Adam's function slightly to get all solid lines.
I had to do this for our project; see
<http://research.iarc.uaf.edu/IPY-CTSM/03_04_troposphere_plot.php>
David A.

;************************************************************************
; Adam Phillips (small mod to all solid lines, D Atkinson)
;
; Set neg contour lines to dash and draw with the color cneg,
; draw positive contours with the color cpos, and draw the zero line with
; the color czero.

; Usage: plot= ColorNegDashZeroPosContourMod(plot,"blue","black","red")
;
;
undef("ColorNegDashZeroPosContourMod")
function
ColorNegDashZeroPosContourMod(plot:graphic,cneg:string,czero:string,\
                                    cpos:string)

local cnlvls, cnlinepat, n, N, cncolor
begin

  cnlvls = get_cnLevels (plot)

  N = dimsizes(cnlvls)
  if (ismissing(N) .or. N.le.0) then
     print ("NegDashLineContour: dimsizes(cnlvls)="+N+" return (non-fatal)")
     return (plot)
  else
     cnlvls = FixZeroContour (cnlvls, "NegDashLineContour")
  end if

  if (any(cnlvls.lt.0.)) then
     cnlinepat = new (dimsizes(cnlvls), integer) ; create array for line
pats
     cnlinepat = 0 ; default is solid (=0)
     cncolor = new (dimsizes(cnlvls), string) ; create array for line
colors
     cncolor = cpos ; default is black
     do p=0,dimsizes(cnlvls)-1
        if (cnlvls(p).lt.-1.e-05) then
          cnlinepat(p) = 0 ; simple dash line
pattern DEA MODIFIED AUG 2007 TO SOLID LINE
      cncolor(p) = cneg
        end if
    if (cnlvls(p).ge.-1.e-05.and.cnlvls(p).le.1.e-05) then
      cncolor(p) = czero
    end if
     end do
   
     ovrly_plot = GetOverlayPlot (plot, "contourPlotClass", 0)
     setvalues ovrly_plot
        "cnMonoLineDashPattern" : False
        "cnLineDashPatterns" : cnlinepat
        "cnMonoLineColor" : False
        "cnLineColors" : cncolor
     end setvalues
   end if ; any
   return (plot)
end

-- 
David E. Atkinson, PhD
Assistant Professor of Atmospheric Sciences
International Arctic Research Center
930 Koyukuk Drive
P.O. Box 757335
University of Alaska Fairbanks
Fairbanks   AK  99775-7335
tel: +1.907.474.1126
fax: +1.907.474.2643
email: datkinson @ iarc.uaf.edu
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Dec 06 2007 - 13:57:15 MST

This archive was generated by hypermail 2.2.0 : Tue Dec 11 2007 - 14:19:21 MST