[ncl-talk] polymarkers draw order in panel plot
Stephanie
sslade1 at atmos.colostate.edu
Fri Dec 4 15:54:10 MST 2015
Hi Mary (and all users),
I was able to get it to work! Here is what worked for me in case it
helps anyone else in the future:
Everything (contours, map, and polymakers) had to be set to "PostDraw"
and OLR set to "Draw" (the OLR plot has the map resources attached to
it). Prior to the overlay the polymarkers had to be drawn to any plot
except for the OLR plot (the last in the overlay). So this is what
worked for me:
plot_ov(n) =
gsn_csm_vector(wks,composite_U(lags(l),:,:),composite_V(lags(l),:,:),res)
plot_o(n) = gsn_csm_contour(wks,composite_PSI(lags(l),:,:),res3)
plot_n(n) = gsn_csm_contour(wks,composite_zonal(lags(l),:,:),res6)
plot(n) = gsn_csm_contour_map_ce(wks,composite_OLR(lags(l),:,:),res2)
gsres = True
gsres at gsMarkerColor = "black"
gsres at gsMarkerThicknessF = 3.0
gsres at tfPolyDrawOrder = "PostDraw"
mark(n) = gsn_add_polymarker(wks,plot_ov(n),lon_max(lags(l)),
lat_max(lags(l)),gsres);
overlay(plot_o(n),plot_n(n))
overlay(plot_ov(n),plot_o(n))
overlay(plot(n),plot_ov(n))
Thank you again, Mary, for your time.
Stephanie
On 12/4/15 3:34 PM, Stephanie wrote:
> Hi Mary,
>
> Thank you for your quick reply. I tried setting some to predraw
> rather than draw, and no change. Here is my figure script, where the
> map outline disappears with res2 at mpOutlineDrawOrder = "Draw" (as it is
> below). What I would like is the map outline to be under all
> contours, vectors, and the polymarkers.
>
> Thank you!
> Stephanie
>
> wks = gsn_open_wks("eps" ,"Figure9")
> gsn_define_colormap(wks,"BlueWhiteOrangeRed")
>
> res2 = True
> res2 at gsnDraw = False
> res2 at gsnFrame = False
> res2 at gsnAddCyclic = True
> res2 at cnLineLabelsOn = False
>
> res6 = res2
> res3 = res2
> res4 = res2
>
> ;-- map --
> res2 at mpPerimOn = False
> res2 at mpLimitMode = "LatLon"
> res2 at mpMaxLatF = 80.
> res2 at mpMinLatF = -15.
> res2 at mpMinLonF = -300.
> res2 at mpMaxLonF = 45.
> res2 at mpCenterLonF = -130
> res2 at tmXBLabelFontHeightF = 0.014
> res2 at tmYLLabelFontHeightF = 0.014
> res2 at mpFillOn = False
> res2 at mpGeophysicalLineThicknessF = 1.3
> res2 at mpGeophysicalLineColor = "steelblue4"
> res2 at mpOutlineDrawOrder = "Draw"
>
> res2 at tmXTOn = False ; Turn off tickmarks and labels
> res2 at tmYROn = False
> res2 at mpShapeMode = "FreeAspect"
> res2 at vpWidthF = 0.88
> res2 at vpHeightF = 0.38
>
> res2 at tmYLLabelsOn = False ; do not draw left labels
> res2 at tmYLOn = False ; no left tickmarks
> res2 at tmXBLabelsOn = False ; do not draw bottom
> labels
> res2 at tmXBOn = False ; no bottom tickmarks
>
> ;-- OLR --
> res2 at cnFillOn = True ; color fill
> res2 at cnLinesOn = False
> res2 at gsnSpreadColors = True ; use full colormap
> res2 at lbLabelBarOn = False
> res2 at cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
> res2 at cnMinLevelValF = -25 ; set min contour level
> res2 at cnMaxLevelValF = 25
> res2 at cnLevelSpacingF = 2.5 ; set contour interval
> res2 at cnInfoLabelOn = False
> res2 at cnFillDrawOrder = "Draw"
>
> ;-- vectors --
> res = True
> res at gsnDraw = False
> res at gsnFrame = False
> res at gsnAddCyclic = True
> res at vcRefLengthF = 0.052 ; reference vector length
> res at vcMinDistanceF = 0.025 ; thin the vectors
> res at vcLineArrowHeadMinSizeF = 0.0075
> res at vcLineArrowHeadMaxSizeF = 0.0075
> res at vcRefAnnoString2On = False
> res at vcRefAnnoPerimOn = False
> res at vcRefAnnoOrthogonalPosF = 0.2 ; move ref vector up
> or down
> res at vcRefAnnoParallelPosF = 0.97 ; move ref vector
> left or right
> res at vcRefAnnoFontHeightF = 0.015 ;font size of
> reference vector number
> res at vcVectorDrawOrder = "Draw"
>
> ;-- Streamfunction --
> res3 at cnFillOn = False
> res3 at cnLinesOn = True
> res3 at cnLineThicknessF = 1.3
> res3 at cnLineLabelsOn = False
> res3 at gsnContourNegLineDashPattern = 1 ; sets negative contours
> to dash pattern 1
> res3 at cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
> res3 at cnMinLevelValF = -275 ; set min contour level
> res3 at cnMaxLevelValF = 275
> res3 at cnLevelSpacingF = 15 ; set contour interval
> res3 at cnInfoLabelOn = False
> res3 at cnLineDrawOrder = "Draw"
>
> ;-- Zonal Wind --
> res6 at cnFillOn = False
> res6 at cnLinesOn = True
> res6 at cnLineThicknessF = 1.5
> res6 at cnLineLabelsOn = False
> res6 at cnMonoLineColor = False
> res6 at cnLineColors = (/205,215,230,240,255/)
>
> res6 at cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
> res6 at cnMinLevelValF = 40 ; set min contour level
> res6 at cnMaxLevelValF = 80
> res6 at cnLevelSpacingF = 10 ; set contour interval
> res6 at cnInfoLabelOn = False
> res6 at cnLineDrawOrder = "Draw"
>
> ; Create a panel of plots
> pres = True
> pres at gsnFrame = False
> pres at gsnPaperOrientation = "portrait"
> pres at gsnMaximize = True
> pres at gsnPanelBottom = 0.05
> pres at gsnPanelYWhiteSpacePercent = 6
> pres at gsnPanelXWhiteSpacePercent = 0
> pres at gsnPanelLabelBar = True
> pres at lbLabelFontHeightF = 0.008
> pres at pmLabelBarOrthogonalPosF = 0.04 ;moves it up and down
>
> pres at pmLabelBarWidthF = 0.5
> pres at pmLabelBarParallelPosF = 0.05
> pres at lbTitleOn = True ; turn on title
> pres at lbTitleString = "[W/m~S~2~N~]" ; title string
> pres at lbTitlePosition = "Right" ; title position
> pres at lbTitleFontHeightF= .011 ; make title smaller
> pres at lbTitleDirection = "Across" ; title direction
> pres at lbTitleJust = "CenterLeft"
>
>
> plot= new(8,graphic)
> plot_o= new(8,graphic)
> plot_ov = new(8,graphic)
> mark = new(8,graphic)
> plot_n = new(8,graphic)
>
> lags = (/6,10,14,18,22,26,30,34/)
>
>
> l = 0
>
> do n=0,dimsizes(lags)-1
>
> res at gsnLeftString = "Lag " + lag(lags(l))
> res at gsnLeftStringOrthogonalPosF=.02
> res at txFontHeightF = 0.035
>
> if(n .le. 5)
> rf = 25.
> else
> rf = 55.
> end if
>
> if((n % 2) .eq. 0)
> res2 at tmYLLabelsOn = True ; do not draw left labels
> res2 at tmYLOn = True ; no left tickmarks
>
> res2 at tmYLMode = "Explicit"
> res2 at tmYLValues = (/-15,0,15, 30,45, 60,75/)
> res2 at tmYLLabels =
> (/"15~S~o~N~S","0~S~o~N~","15~S~o~N~N","30~S~o~N~N","45~S~o~N~W","60~S~o~N~N","75~S~o~N~N"/)
>
> else
>
> res2 at tmYLLabelsOn = False ; do not draw left labels
> res2 at tmYLOn = False ; no left tickmarks
>
> end if
>
> if(n .gt. 5)
> res2 at tmXBLabelsOn = True ; do not draw bottom
> labels
> res2 at tmXBOn = True
>
> res2 at tmXBMode = "Explicit"
> res2 at tmXBValues = (/-270,-225,-180,-135, -90,-45, 0, 45/)
> res2 at tmXBLabels =
> (/"90~S~o~N~E","135~S~o~N~E","180~S~o~N~","135~S~o~N~W","90~S~o~N~W","45~S~o~N~W","0~S~o~N~","45~S~o~N~E"/)
>
>
> end if
>
> ;-- vectors --
> res at vcRefMagnitudeF = rf ; make vectors larger
> res at vcRefAnnoOn = True
> res at vcRefAnnoString1 = rf + " m~S~2~N~/s~S~2~N~"
>
> if(n .eq. 5)
> res at vcRefAnnoOrthogonalPosF = 0.02 ; move ref vector
> up or down
> else
> res at vcRefAnnoOrthogonalPosF = 0.2 ; move ref vector up
> or down
> end if
>
>
> plot_ov(n) =
> gsn_csm_vector(wks,composite_U(lags(l),:,:),composite_V(lags(l),:,:),res)
> plot_o(n) = gsn_csm_contour(wks,composite_PSI(lags(l),:,:),res3)
> plot_n(n) = gsn_csm_contour(wks,composite_zonal(lags(l),:,:),res6)
> plot(n) = gsn_csm_contour_map_ce(wks,composite_OLR(lags(l),:,:),res2)
>
>
> overlay(plot_o(n),plot_n(n))
> overlay(plot_ov(n),plot_o(n))
> overlay(plot(n),plot_ov(n))
>
> gsres = True
> gsres at gsMarkerColor = "black"
> gsres at gsMarkerThicknessF = 3.0
> gsres at tfPolyDrawOrder = "PostDraw"
> mark(n) = gsn_add_polymarker(wks,plot(n),lon_max(lags(l)),
> lat_max(lags(l)),gsres)
>
>
>
> l = l + 1
> end do
>
> gsn_panel(wks,plot, (/5,2/), pres)
>
>
>
> On 12/4/15 2:33 PM, Mary Haley wrote:
>> Stephanie,
>>
>> Can you send us a script that shows what you are trying to do?
>>
>> I was able to get the markers to appear on top of the map outlines by
>> setting:
>>
>> res at tfPolyDrawOrder = "PostDraw"
>> res at mpOutlineDrawOrder = "Draw"
>>
>> but I was only drawing maps and markers, and no contours or vectors.
>> Without knowing what kind of plot elements you're drawing, I can't
>> really reproduce your problem.
>>
>> It might be that you need to set some of the other items to "predraw"
>> rather than "draw".
>>
>> --Mary
>>
>>
>> On Fri, Dec 4, 2015 at 1:26 PM, Stephanie
>> <sslade1 at atmos.colostate.edu <mailto:sslade1 at atmos.colostate.edu>> wrote:
>>
>> Hi NCL users,
>>
>> I'm having trouble overlaying polymarkers in a figure so that the
>> polymarkers are on top of everything. My plot is a panel plot with
>> multiple overlays in each panel, and each panel has a polymarker
>> which
>> is in a different location in each panel (so gsn_panel has to be
>> called
>> after drawing the polymarkers). My main concern is that the map
>> outline
>> sits on top of the polymarkers. I attempted to set the draw
>> order for
>> each layer by setting everything to "Draw" and the polymarkers to
>> "PostDraw", however this caused the background map outline to
>> completely
>> disappear with everything else in tact. Any suggestions would be
>> greatly appreciated.
>>
>> Thank you all in advance!
>>
>> Stephanie
>>
>> --
>> Stephanie A. Henderson
>> (Formerly Stephanie A. Slade)
>> PhD Candidate
>> Department of Atmospheric Science
>> Colorado State University
>> Fort Collins, CO 80523
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
> --
> Stephanie A. Henderson
> (Formerly Stephanie A. Slade)
> PhD Candidate
> Department of Atmospheric Science
> Colorado State University
> Fort Collins, CO 80523
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
--
Stephanie A. Henderson
(Formerly Stephanie A. Slade)
PhD Candidate
Department of Atmospheric Science
Colorado State University
Fort Collins, CO 80523
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151204/31a4a444/attachment.html
More information about the ncl-talk
mailing list