[ncl-talk] How to add a text to the color bar

Anahita Amiri Farahani aamir003 at ucr.edu
Wed Aug 31 14:10:41 MDT 2016


Hi all,

I've tried to add a text to color bar but it does' work. I've attached the
figure and here is the code:


 wks = gsn_open_wks("eps","percent_whole")
 gsn_define_colormap(wks,"gui_default")
 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 = 47.5                         ; specify the plot domain
  res at mpMinLatF = 0.5                         ;
  res at mpMinLonF = -44.5                        ;
  res at mpMaxLonF = 14.5

  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       =  80              ; max level
  res at cnLevelSpacingF      =  5               ; interval



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

res at gsnLeftString       = "Winter"         ; change left string
plot(0) = gsn_csm_contour_map_ce(wks,cldfrq_winter,res)
res at gsnLeftString       = "Spring"         ; change left string
plot(1) = gsn_csm_contour_map_ce(wks,cldfrq_spring,res)
res at gsnLeftString       = "Summer"         ; change left string
plot(2) = gsn_csm_contour_map_ce(wks,cldfrq_summer,res)
res at gsnLeftString       = "Fall"         ; change left string
plot(3) = gsn_csm_contour_map_ce(wks,cldfrq_fall,res)


;************************************************
; 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

res at lbTitleString    = "Percent"                ; title string
res at lbTitlePosition  = "Right"              ; title position
res at lbTitleFontHeightF= .02                ; make title smaller
res 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/20160831/0ad26c22/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: percent_whole.eps
Type: application/postscript
Size: 402561 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160831/0ad26c22/attachment-0001.eps 


More information about the ncl-talk mailing list