[ncl-talk] Custom panel plot

Appo derbetini appopson4 at gmail.com
Tue May 22 03:11:04 MDT 2018


Hi James
I am on the right now as you can see on the attached plot.

I am also sending script i used.

Thank you




   fname = "tas_2006.nc"
    f     = addfile(fname,"r")
        t       = f->tas(:, {-15:15}, {5:35})

    lon = t&lon
    lat = t&lat



   pltDir = "./"                ; where output will be written
   pltName= "panel29"
   pltType= "png"               ; ps, eps, png, pdf, x11 .....

;****************************************************************************
; Miscellaneous
;****************************************************************************
  nrow = 3
  ncol = 4



;****************************************************************************
; Graphic resources
;****************************************************************************
  pltPath = pltDir+pltName
  wks     = gsn_open_wks(pltType ,pltPath)

  res                       = True     ; plot mods desired
  res at gsnDraw               = False
  res at gsnFrame              = False

  res at cnFillOn              = True     ; turn on color fill
  res at cnLinesOn             = False    ; turn of contour lines
  res at cnLineLabelsOn        = False    ; turn of contour line labels
  ;res at cnLevelSelectionMode  = "ManualLevels"    ; set manual contour levels

  res at lbLabelBarOn          = False



 res at mpProjection                = "CylindricalEquidistant"       ;
projection
 res at mpLimitMode                 = "Corners"        ; method to zoom
 res at mpLeftCornerLatF            = min(lat)
 res at mpLeftCornerLonF            = min(lon)
 res at mpRightCornerLatF           = max(lat)
 res at mpRightCornerLonF           = max(lon)
 res at tfDoNDCOverlay              = True             ; do no
 res at gsnAddCyclic                = False            ; regional data, don't
add pt


  res at tmYLLabelsOn          = False    ; turn off lat labels
  res at tmXBLabelsOn          = False    ; turn off lon labels

  res at mpDataBaseVersion     = "MediumRes"
  res at mpFillOn              = True
  res at mpOutlineOn           = True
  ;res at mpFillColors          = (/-1,0,-1,-1/)       ; mask out all non-land
areas
  res at mpFillOn                    = False        ; turn off gray fill

  res at mpFillDrawOrder       = "PostDraw"
  res at mpProjection          = "CylindricalEquidistant"


  ;Ressource column 1
   res1 = True
   res1 = res
   res1 at cnFillPalette        = "WhiteYellowOrangeRed"
   res1 at lbOrientation      = "Horizontal"        ; orientation
   ;res1 at pmLabelBarWidthF   = 0.8
   ;res1 at pmLabelBarHeightF  = 0.03

   res1 at lbLabelBarOn       = False
   res1 at lbBoxEndCapStyle      = "TriangleBothEnds"


   ;Ressource columns 2 & 3
     res2 = True
     res2 = res
     res2 at cnFillPalette        = "MPL_YlGn"
     res2 at lbOrientation      = "Horizontal"        ; orientation
     res2 at pmLabelBarWidthF   = 1.1
     ;res2 at pmLabelBarOrthogonalPosF  = -0.02
     res2 at pmLabelBarParallelPosF  = -0.02

     res2 at lbBoxEndCapStyle      = "TriangleBothEnds"


    ;Ressource column 4
     res3 = True
     res3 = res
     res3 at cnFillPalette        = "MPL_RdPu"
     res3 at lbOrientation      = "Horizontal"        ; orientation
     ;res3 at pmLabelBarWidthF   = 0.8

     res3 at lbBoxEndCapStyle      = "TriangleBothEnds"


;****************************************************************************
; Generate panel entries
;****************************************************************************
                               ; only one time per file
  plot = new(nrow*ncol , "graphic")

  ;res at cnFillPalette        = "WhiteYellowOrangeRed"
    ;res1 at tmYLLabelsOn          = True    ; turn off lat labels
   plot(0) = gsn_csm_contour_map(wks, t(0, :, :), res1)

     res2 at tmYLLabelsOn          = False    ; turn off lat labels
   plot(1) = gsn_csm_contour_map(wks, t(1, :, :), res2)
   plot(2) = gsn_csm_contour_map(wks, t(2, :, :), res2)
   plot(3) = gsn_csm_contour_map(wks, t(3, :, :), res3)


    ;res1 at tmYLLabelsOn          = True
    plot(4) = gsn_csm_contour_map(wks, t(4, :, :), res1)
    res2 at tmYLLabelsOn          = False    ; turn off lat labels
    plot(5) = gsn_csm_contour_map(wks, t(5, :, :),  res2)
    plot(6) = gsn_csm_contour_map(wks, t(6, :, :), res2)
    plot(7) = gsn_csm_contour_map(wks, t(7, :, :),  res3)


    res1 at lbLabelBarOn          = True
    ;res2 at tmYLLabelsOn          = True
    ;res1 at tmXBLabelsOn          = True    ; turn off lon labels
    ;res2 at tmXBLabelsOn          = True    ; turn off lon labels

    plot(8) = gsn_csm_contour_map(wks, t(8, :, :), res1)
    res2 at tmYLLabelsOn          = False    ; turn off lat labels
    plot(9) = gsn_csm_contour_map(wks, t(9, :, :),  res2)

      res2 at lbLabelBarOn       = True
    plot(10) = gsn_csm_contour_map(wks, t(10, :, :),res2)

    res3 at lbLabelBarOn       = True
   plot(11) = gsn_csm_contour_map(wks, t(11, :, :), res3)





;****************************************************************************
; Draw the panel and label bars
;****************************************************************************
  resP = True
  ;resP at gsnPanelMainString = "Land Only: Tmax: 2 Colorbars"
  resP at gsnMaximize = True
  resP at gsnFrame    = False
 ;resP at gsnPanelRight  = 0.98
  ;resP at gsnPanelBottom = 0.045

   resP at gsnPanelFigureStrings=
(/"1","1","1","1","2","2","2","2","3","3","3","3"/) ; add strings to panel
    resP at amJust   = "BottomLeft"

  gsn_panel(wks,plot,(/nrow,ncol/),resP)  ; plots



  frame(wks)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180522/ccfc1842/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: panel29.png
Type: image/png
Size: 145182 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180522/ccfc1842/attachment-0001.png>


More information about the ncl-talk mailing list