DKRZ NCL example arrange multiple plots on one page#

Example script:

;------------------------------------------------------------------------------
; DKRZ NCL example: viewport_panels.ncl
;
; Description: Create a panel 3x3 using vp-resources instead of
;   gsn_panel function:
;
;     1. arrange plots 3 rows by 2 columns
;     2. use different map projections
;     3. zoom into map
;     4. use different plot sizes
;     5. use vp-resources to create the panel
;
;  06.11.19  kmf
;------------------------------------------------------------------------------
begin

 projection = (/"Mollweide", "Robinson","Orthographic", "Stereographic",\
                "CylindricalEquidistant","PolarStereographic"/)

;-- open workstation
 wks = gsn_open_wks("png", "plot_viewport_panels")

 mres = True
 mres@gsnFrame = False

 mres@vpWidthF = 0.35
 mres@vpHeightF = 0.3

 mres@mpLandFillColor = "white"
 mres@mpOutlineOn = True
 mres@mpGeophysicalLineColor= "black"
 mres@mpPerimOn = False
 mres@mpGridAndLimbOn = True

 mres@tiMainFontHeightF = 0.016

 plots = new(6,graphic)

 j = 0
 do i=0,5
    mres@mpProjection = projection(i)
    mres@tiMainString = mres@mpProjection
    mres@vpYF = 0.999 - 0.34*j

    if((i%2) .eq. 0) then
       mres@vpXF = 0.07
    else
       mres@vpXF = 0.52
       j = j + 1
    end if

    if(mres@mpProjection .eq. "PolarStereographic") then
       delete([/mres@mpMinLonF, mres@mpMaxLonF, mres@mpProjection/])
       mres@tiMainOffsetYF = -0.005 ;-- move title downward
       mres@gsnPolar = "NH"
       mres@mpMinLatF = 0
       mres@mpCenterLonF = 0
       plots(i) = gsn_csm_map_polar(wks,mres)
    elseif(mres@mpProjection .eq. "Mollweide") then
       mres@vpYF = 1.035
       mres@vpWidthF = 0.42
       mres@vpHeightF = 0.38
       plots(i) = gsn_csm_map(wks,mres)
    else
       mres@mpMinLatF = 40
       mres@mpMaxLatF = 60
       mres@mpMinLonF = -12
       mres@mpMaxLonF = 20
       plots(i) = gsn_csm_map(wks,mres)
    end if

    mres@vpWidthF = 0.35
    mres@vpHeightF = 0.3
 end do

 frame(wks)
end

Result:

../../../../../../_images/plot_viewport_panels_w400.png