[ncl-talk] Panel plots and blocks on each indivdual plot

Melissa Lazenby M.Lazenby at sussex.ac.uk
Tue Oct 20 09:49:23 MDT 2015


Hi NCL users

I am plotting panel plots of different CMIP5 models and I would like to draw 2 boxes on each individual model plot.

At the moment the code is only drawing 2 boxes on the last model plot of the panel.

Please can someone advise me on making all the boxes appear on all the individual models.

Many thanks!

Kindest Regards
Melissa

Below is a snippet of my code to create these boxes on each of the models as I loop through the 30 models (gg)

 plot(gg) = gsn_csm_contour_map(wks,ccr({-60:60},{-180:180}),rescn)


; create points for box
;************************************************
 ypts = (/ -27, -27,  -37, -37, -27/)
 xpts = (/55, 65, 65, 55, 55/)
;************************************************
; add the box
;************************************************
  resp                  = True                      ; polyline mods desired
  resp at gsLineColor      = "black"                     ; color of lines
  resp at gsLineThicknessF = 3.0                       ; thickness of lines
  ;resp at gsLineLabelString= "test"                    ; adds a line label string

; create array of dummy graphic variables. This is required, b/c each line
; must be associated with a unique dummy variable.

  dum = new(4,graphic)

 draw each line separately. Each line must contain two points.
  do i = 0 , 3
    dum(i)=gsn_add_polyline(wks,plot(gg),xpts(i:i+1),ypts(i:i+1),resp)
  end do

; create points for box
;************************************************
 iypts = (/ -18, -18,  -28, -28, -18/)
 ixpts = (/90, 100, 100, 90, 90/)
;************************************************
; add the box 2
;************************************************
  dum2 = new(4,graphic)

 draw each line separately. Each line must contain two points.
  do i = 0 , 3
    dum2(i)=gsn_add_polyline(wks,plot(gg),ixpts(i:i+1),iypts(i:i+1),resp)
  end do
end do

; panel resource list  (if necessary)

panres                = True              ; mod panel plot
 panres at cnMinLevelValF       = -0.02
  panres at cnMaxLevelValF       =  0.02
  panres at cnLevelSpacingF      =  0.01
panres at gsnPanelLabelBar   = True                ; add common colorbar
panres at lbLabelFontHeightF = 0.015                 ; make labels larger
panres at lbLabelStride = 1
panres at gsnMaximize = True ; Maximize plot in frame.
gsn_panel(wks,plot(:12),(/4,3/),panres)    ; panel 16 models at a time.
gsn_panel(wks,plot(13:24),(/4,3/),panres)
gsn_panel(wks,plot(25:),(/4,3/),panres)

end

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151020/cdbfd2b9/attachment.html 


More information about the ncl-talk mailing list