<div dir="ltr"><div><div><div><div><div><div><div>Hi,<br><br></div>I'm not totally certain what is going on, but it very much sounds like you are overwriting the graphics objects from previous plots; i.e., your variable "dum" and "dum2". The way you've got things set up, these variables would need to be dimensioned Nx4, where N is the number of plots. <br><br></div>Also, I think that rather than write:<br><br> do i = 0 , 3<br>
dum2(i)=gsn_add_polyline(wks,plot(gg),ixpts(i:i+1),iypts(i:i+1),resp)<br>
end do<br><br></div>you could write:<br><br></div> dum2(gg) = gsn_add_polyline(wks, plot(gg), ixpts, iypts, resp)<br><br></div>and thus the graphics arrays just need to be dimensioned N.<br><br></div>Make sense?<br><br></div>Rick<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 20, 2015 at 9:49 AM, Melissa Lazenby <span dir="ltr"><<a href="mailto:M.Lazenby@sussex.ac.uk" target="_blank">M.Lazenby@sussex.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">Hi NCL users<br>
<br>
I am plotting panel plots of different CMIP5 models and I would like to draw 2 boxes on each individual model plot.<br>
<br>
At the moment the code is only drawing 2 boxes on the last model plot of the panel.<br>
<br>
Please can someone advise me on making all the boxes appear on all the individual models.<br>
<br>
Many thanks!<br>
<br>
Kindest Regards<br>
Melissa<br>
<br>
Below is a snippet of my code to create these boxes on each of the models as I loop through the 30 models (gg)<br>
<br>
plot(gg) = gsn_csm_contour_map(wks,ccr({-60:60},{-180:180}),rescn)<br>
<br>
<br>
; create points for box<br>
;************************************************<br>
ypts = (/ -27, -27, -37, -37, -27/)<br>
xpts = (/55, 65, 65, 55, 55/)<br>
;************************************************<br>
; add the box<br>
;************************************************<br>
resp = True ; polyline mods desired<br>
resp@gsLineColor = "black" ; color of lines<br>
resp@gsLineThicknessF = 3.0 ; thickness of lines<br>
;resp@gsLineLabelString= "test" ; adds a line label string<br>
<br>
; create array of dummy graphic variables. This is required, b/c each line<br>
; must be associated with a unique dummy variable.<br>
<br>
dum = new(4,graphic)<br>
<br>
draw each line separately. Each line must contain two points.<br>
do i = 0 , 3<br>
dum(i)=gsn_add_polyline(wks,plot(gg),xpts(i:i+1),ypts(i:i+1),resp)<br>
end do<br>
<br>
; create points for box<br>
;************************************************<br>
iypts = (/ -18, -18, -28, -28, -18/)<br>
ixpts = (/90, 100, 100, 90, 90/)<br>
;************************************************<br>
; add the box 2<br>
;************************************************<br>
dum2 = new(4,graphic)<br>
<br>
draw each line separately. Each line must contain two points.<br>
do i = 0 , 3<br>
dum2(i)=gsn_add_polyline(wks,plot(gg),ixpts(i:i+1),iypts(i:i+1),resp)<br>
end do<br>
end do<br>
<br>
; panel resource list (if necessary)<br>
<br>
panres = True ; mod panel plot<br>
panres@cnMinLevelValF = -0.02<br>
panres@cnMaxLevelValF = 0.02<br>
panres@cnLevelSpacingF = 0.01<br>
panres@gsnPanelLabelBar = True ; add common colorbar<br>
panres@lbLabelFontHeightF = 0.015 ; make labels larger<br>
panres@lbLabelStride = 1<br>
panres@gsnMaximize = True ; Maximize plot in frame.<br>
gsn_panel(wks,plot(:12),(/4,3/),panres) ; panel 16 models at a time.<br>
gsn_panel(wks,plot(13:24),(/4,3/),panres)<br>
gsn_panel(wks,plot(25:),(/4,3/),panres)<br>
<br>
end<br>
<br>
</div>
</div>
<br>_______________________________________________<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/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>