<div dir="ltr"><div><div>Hi Cathy,<br><br></div>I spent some time looking around for some other means, but couldn't find one that was short of programmatically constructing everything oneself. However, the function ColorNegDashZeroPosContour, contributed by Adam Phillips, is pretty straightforward and relatively short -- you can easily modify it. I've appended it below, and commented out the line that forces the dash pattern (also colored in red) -- you could "load" this custom version for your own needs.<br><br></div>Rick<br><br>;************************************************************************<br>; Adam Phillips<br>;<br>; Set neg contour lines to dash and draw with the color cneg,<br>; draw positive contours with the color cpos, and draw the zero line with<br>; the color czero.<br><br>; Usage: plot= ColorNegDashZeroPosContour(plot,"blue","black","red")<br>;<br>;<br>undef("ColorNegDashZeroPosContour")<br>function ColorNegDashZeroPosContour(plot:graphic,cneg:string,czero:string,\<br> cpos:string)<br><br>local cnlvls, cnlinepat, n, N, cncolor<br>begin<br><br> cnlvls = get_cnLevels (plot)<br><br> N = dimsizes(cnlvls)<br> if (ismissing(N) .or. N.le.0) then<br> print ("NegDashLineContour: dimsizes(cnlvls)="+N+" return (non-fatal)")<br> return (plot)<br> else<br> cnlvls = FixZeroContour (cnlvls, "NegDashLineContour")<br> end if<br><br> if (any(cnlvls.lt.0.)) then<br> cnlinepat = new (dimsizes(cnlvls), integer) ; create array for line pats<br> cnlinepat = 0 ; default is solid (=0)<br> cncolor = new (dimsizes(cnlvls), string) ; create array for line colors<br> cncolor = cpos ; default is black<br> do p=0,dimsizes(cnlvls)-1<br> if (cnlvls(p).lt.-1.e-05) then<br><span style="color:rgb(255,0,0)">; ; cnlinepat(p) = 1 ; simple dash line pattern</span><br> cncolor(p) = cneg<br> end if<br> if (cnlvls(p).ge.-1.e-05.and.cnlvls(p).le.1.e-05) then<br> cncolor(p) = czero<br> end if<br> end do<br> <br> ovrly_plot = GetOverlayPlot (plot, "contourPlotClass", 0)<br> setvalues ovrly_plot<br> "cnMonoLineDashPattern" : False<br> "cnLineDashPatterns" : cnlinepat<br> "cnMonoLineColor" : False<br> "cnLineColors" : cncolor<br> end setvalues<br> end if ; any<br> return (plot)<br>end<br><br><div><br><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 12, 2018 at 9:56 AM, Cathy Smith via ncl-talk <span dir="ltr"><<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>Hi all: <br>
</p>
<p>I am using ColorNegDashZeroPosContour as in</p>
<p> plot = ColorNegDashZeroPosContour(<wbr>plot,"red","magenta","blue")</p>
<p>This works great except I would like the negative lines not
dashed. I tried setting the resource dashline type to solid and
when I checked the res, it is set that way e.g. <br>
</p>
<pre style="padding:0px;margin:0px;color:rgb(68,68,68);font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(255,255,255)">gsnContourNegLineDashPattern : 0
Is it possible to do what I want with ColorNegDashZeroPosContour? Or is there another routine I should try? Or do I need to hand code this? I have
res@<wbr>gsnContourNegLineDashPattern = 0 ; sets negative contours to dash pattern 1
plot = gsn_csm_contour_map_ce (wks, mapx({lat1:lat2},{lon1:lon2}), res) ; create ;temporary plot
plot = ColorNegDashZeroPosContour(<wbr>plot,"red","magenta","blue")
print(res)
draw(plot)
frame(wks)
Thanks!
Cathy
</pre><span class="HOEnZb"><font color="#888888">
<pre class="m_-2418599140497711982moz-signature" cols="72">--
------------------------------<wbr>----------------
NOAA/ESRL PSD and CU CIRES
<a href="tel:(303)%20497-6263" value="+13034976263" target="_blank">303-497-6263</a>
<a class="m_-2418599140497711982moz-txt-link-freetext" href="http://www.esrl.noaa.gov/psd/people/cathy.smith/" target="_blank">http://www.esrl.noaa.gov/psd/<wbr>people/cathy.smith/</a>
Emails about data/webpages may get quicker responses from emailing
<a class="m_-2418599140497711982moz-txt-link-abbreviated" href="mailto:esrl.psd.data@noaa.gov" target="_blank">esrl.psd.data@noaa.gov</a></pre>
</font></span></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>