>Mateus da Silva Teixeira wrote:
>> You may use the function ZeroNegDashLineContour() to get the inverse -
>> negative contours =dash and positive contours = solid - like you may see
>> below
>> plot = gsn_csm_contour_map_ce( xwks , eofs_hgt , False)
>> plot = ZeroNegDashLineContour( plot )
>> I hope this help you
-----------
>Thank you for your suggestion, but the negative are still dashed lines
>and positive contours are solid lines.
>
>What I need is the opposite.
--
>
>Michael Notaro <mnotaro_at_wisc.edu>
>If you want solid contours for values of say -2 and -1 and
>dashed for values of +1 and +2, this should work, for example:
>
> res_at_cnLevelSelectionMode = "ExplicitLevels"
> res_at_cnLevels = (/-2,-1,1,2/)
> res_at_cnMonoLineDashPattern = False
> res_at_cnLineDashPatterns = (/0,0,2,2/)
>
>Mike
=======
THX to Mateus and Mike for responding ... always appreciated.
In fact, I suggest that more people respond. Believe me, you
will learn more about NCL by crafting answers to questions.
=======
>>>
>>> I would like to use dashed line for positive contour and solid line
>>> for negative contour. Is there easy way to do it?
>>>
>>> Thank you.
>>>
>>> Sang-ki
++++++++++++++++++++++++++++++++++++++++++++++
[1] The ZeroNegDashLineContour function was written when
I first learned NCL. Subsequently, Mary Haley added
two gsn resources to allow the same functionality.
The advantage is that the user no longer needs to
set gsnDraw/gsnFrame to False; invoke the
ZeroNegDashLineContour function; manually draw and
advance the frame.
The functionality can obtained by setting the
"gsnContourNegLineDashPattern" and
"gsnContourZeroLineThicknessF" resources prior
to invoking any gsn_*contour* plot function.
See Examples 1-6 at:
http://www.ncl.ucar.edu/Applications/coneff.shtml
[2] I will request that "gsnContourPosLineDashPattern"
be created ... However, that won't happen for a
a few weeks.
[3] Mike's suggested approach will work. The downside
is that if there are multiple plots with different
contours, it can be tedious.
I extracted the
[4] So ....
I extracted "gsnContourNegLineDashPattern" from
shea_util and modified it. I also
modified the interface so the user can specify
the desired patterns. ***This is untested.***
It must be created after shea_util.ncl because
it calls FixZeroContour which is part of shea_util
So to get the negative contour lines to solid
set negPat=0; for dashed positive contour lines
set negPat=5 (say)
;#####################################################
undef("ZeroNegPosDashLineContour")
function ZeroNegPosDashLineContour (plot:graphic \
,negPat:integer, posPat:integer)
; operates on a plot object created by "gsn_csm.ncl" code
; Make zero line twice as thick and set neg/pos contourlines to dash
; Dash line patterns: http://ngwww.ucar.edu/ngdoc/ng/ref/dashpatterns.html
local cnlvls, cnlinepat, cnlinethk, n, N
begin
cnlvls = get_cnLevels (plot)
N = dimsizes(cnlvls)
if (ismissing(N) .or. N.le.0) then
print ("ZeroNegDashLineContour: dimsizes(cnlvls)=" \
+N+" return (non-fatal)")
return (plot)
else
cnlvls = FixZeroContour (cnlvls, "ZeroNegDashLineContour")
end if
if (any(cnlvls.le.0.)) then
cnlinepat = new (dimsizes(cnlvls), integer) ; line pattern vector
cnlinepat = 0 ; default is solid (=0)
cnlinethk = new (dimsizes(cnlvls), integer) ; line thick vector
cnlinethk = 1 ; default
do n=0,N-1
if (cnlvls(n).lt.0.) then
cnlinepat(n) = negPat ; user specified dash line pattern
end if
if (cnlvls(n).eq.0.) then
cnlinethk(n) = 2 ; make the zero contour thicker
end if
if (cnlvls(n).gt.0.) then
cnlinepat(n) = posPat ; user specified dash line pattern
end if
end do
ovrly_plot = GetOverlayPlot (plot, "contourPlotClass", 0)
setvalues ovrly_plot
"cnMonoLineDashPattern" : False
"cnLineDashPatterns" : cnlinepat
"cnMonoLineThickness" : False
"cnLineThicknesses" : cnlinethk
end setvalues
end if ; any
return (plot)
end
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jan 25 2007 - 13:55:05 MST
This archive was generated by hypermail 2.2.0 : Tue Feb 06 2007 - 15:01:34 MST