[ncl-talk] Problem with plotting

Anahita Amiri Farahani aamir003 at ucr.edu
Fri Apr 26 12:53:11 MDT 2019


Hi all,
I am trying to plot multiple panels in a figure, when I try to put three
panels in a row instead of two panels, NCL changes the quality of panels
and puts less significant symbol in a panel. I attached the code for
plotting. Is it possible to put three panels and keep the quality of the
figure?






wks = gsn_open_wks("eps","SDE")
gsn_define_colormap(wks,"BlWhRe")   ; choose color
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 mpMaxLatF = 90                         ; specify the plot domain
  res at mpMinLatF = -90                         ;
  res at mpMinLonF = 0                        ;
  res at mpMaxLonF = 357.5
  res at mpCenterLonF= 0;178.75



  ;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 lbTitleOn        =  True                ; turn on title
res at lbTitleString    = "(W m~S~-2~N~)"                ; title string
res at lbTitlePosition  = "Right"              ; title position
res at lbTitleFontHeightF= .02                ; make title smaller
res at lbTitleDirection = "Across"             ; title direction



 ;; res at cnLevelSelectionMode =  "AutomaticLevels"   ; AutomaticLevels


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

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

res at gsnLeftString       = "SDE_CAM4"         ; change left string
plot(0)= gsn_csm_contour_map(wks,sde_cam4(:,:),res)
res at gsnLeftString       = "SDE_CAM5"         ; change left string
plot(1)= gsn_csm_contour_map(wks,sde_cam5(:,:),res)
res at gsnLeftString       = "SDE_GFDL"         ; change left string
plot(2)=gsn_csm_contour_map(wks,sde_gfdl(:,:),res)

res at gsnLeftString       = "Model Agreement"         ; change left string
plot(3)= gsn_csm_contour_map(wks,aa_sde(:,:),res)


;delete(wks)
; ========================= 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 cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
  res2 at cnMinLevelValF      = 0.00        ; set min contour level
  res2 at cnMaxLevelValF      = 1.05        ; set max contour level
  res2 at cnLevelSpacingF     = 0.05        ; set contour spacing

  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 cnLinesOn           = False       ; do not draw contour lines
  res2 at cnLineLabelsOn      = False       ; do not draw contour labels
  res2 at gsnLeftString = ""
  res2 at gsnRightString = ""

  res2 at cnFillScaleF        = 0.6         ; add extra density
  res2 at cnLevelSpacingF     = 0.04        ; set contour spacing
  ;res2 at gsnAddCyclic = False

plot2   = gsn_csm_contour(wks,gsn_add_cyclic_point(alpha_cam4(:,:)), res2)
plot2   = ShadeGtContour(plot2, 0.95, 17)  ; shade all areas less than the
                                             ; 0.05 contour level
plot3   = gsn_csm_contour(wks,gsn_add_cyclic_point(alpha_cam5(:,:)), res2)
plot3   = ShadeGtContour(plot3, 0.95, 17)

plot4   = gsn_csm_contour(wks,gsn_add_cyclic_point(alpha_gfdl(:,:)), res2)
plot4   = ShadeGtContour(plot4, 0.95, 17)

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


;************************************************
; 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
  gsn_panel(wks,plot,(/3,2/),resP)
 ;gsn_panel(wks,plot,(/2,3/),resP)
  ;draw (plot)
  ;frame(wks)
  delete(wks)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190426/d42861a1/attachment.html>


More information about the ncl-talk mailing list