[ncl-talk] How to have a plot with different panel label bar

Anahita Amiri Farahani aamir003 at ucr.edu
Fri May 18 12:33:05 MDT 2018


Hi all,

For my plots, I used this scripts to create multiple panels with common
label bar, this time i have panels those label bars are different, how can
I add label bar individually under each panel?




wks = gsn_open_wks("eps","Low_clouds_ann")
;gsn_define_colormap(wks,"BlAqGrYeOrRe")
gsn_define_colormap(wks,"BlWhRe")
 plot = new(4,graphic)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  res                     = True               ; plot mods desired
  res at cnFillOn            = True              ; turn on color
  res at gsnSpreadColors     = True               ; use full color map
  res at cnLinesOn           = False              ; no contour lines
  res at cnLineLabelsOn      = False              ; no line labels


 ; res at gsnAddCyclic        = False
  res at gsnDraw             = False           ; don't draw
  res at gsnFrame            = False           ; don't advance frame
  res at cnInfoLabelOn       = False           ; turn off cn info label
  res at cnFillOn            = True            ; turn on color
  res at gsnSpreadColors     = True            ; spread out color table
  res at gsnSpreadColorStart = 2               ; color to startt

  res at lbLabelBarOn        = False           ; turn off individual cb's

;  res at cnLevelSelectionMode =  "AutomaticLevels"   ; AutomaticLevels


  res at cnLevelSelectionMode =  "ManualLevels"   ; AutomaticLevels
  res at cnMinLevelValF       = -20.              ; min level
  res at cnMaxLevelValF       =  20.               ; max level
  res at cnLevelSpacingF      =  2                ; interval


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

res at gsnLeftString       = "CAM4 F_compset"         ; change left string
plot(0) = gsn_csm_contour_map_ce(wks,low_ann_cam4_F,res)
res at gsnLeftString       = "CAM4 E_compset"         ; change left string
plot(1) = gsn_csm_contour_map_ce(wks,low_ann_cam4_E,res)
res at gsnLeftString       = "CAM5"         ; change left string
plot(2) = gsn_csm_contour_map_ce(wks,low_ann_cam5,res)
res at gsnLeftString       = "GFDL"         ; change left string
plot(3) = gsn_csm_contour_map_ce(wks,low_ann_gfdl,res)


; ========================= PLOT 2 ==============================
 res2 = True                            ; res2 probability plots


  res2 at gsnDraw              = False           ; Do not draw plot
  res2 at gsnFrame             = False           ; Do not advance frame

  res2 at cnInfoLabelOn       = False       ; turn off info label

  res2 at cnLinesOn           = False       ; do not draw contour lines
  res2 at cnLineLabelsOn      = False       ; do not draw contour labels

  res2 at cnFillScaleF        = 0.6         ; add extra density
;  delete(alpha at long_name)
;  delete(alpha at units)
  res2 at gsnAddCyclic = False

plot2   = gsn_csm_contour(wks,alphat_low_ann_cam4_F, res2)
plot2   = ShadeGtContour(plot2, 0.05, 17)  ; shade all areas less than the
                                             ; 0.05 contour level
plot3   = gsn_csm_contour(wks,alphat_low_ann_cam4_E, res2)
plot3   = ShadeGtContour(plot3, 0.05, 17)

plot4   = gsn_csm_contour(wks,alphat_low_ann_cam5, res2)
plot4   = ShadeGtContour(plot4, 0.05, 17)

plot5   = gsn_csm_contour(wks,alphat_low_ann_gfdl, res2)
plot5   = ShadeGtContour(plot5, 0.05, 17)



overlay (plot(0), plot2)
overlay (plot(1), plot3)
overlay (plot(2), plot4)
overlay (plot(3), plot5)



;************************************************
; create panel
;************************************************
  resP                  = True                    ; modify the panel plot

  resP at gsnPanelLabelBar = True                    ; add common colorbar
  resP at gsnPanelFigureStrings = (/"a)","b)","c)","d)"/)      ; add strings
to panel
resP at txString         = "Low clolud changes"
resP at lbTitleString    = "%"                ; title string
resP at lbTitlePosition  = "Right"              ; title position
resP at lbTitleFontHeightF= .02                ; make title smaller
resP at lbTitleDirection = "Across"             ; title direction
gsn_panel(wks,plot,(/2,2/),resP)


delete(plot)
delete(res)
delete(resP)
delete(wks)





Thank you,
Ana
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180518/4d4ce163/attachment.html>


More information about the ncl-talk mailing list