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

Mary Haley haley at ucar.edu
Thu Sep 1 12:42:03 MDT 2016


You are setting the labelbar title resources using "res", but "resP" is the
name of the resources for gsn_panel. Change these "res" to "resP":

resP at lbTitleString    = "Percent"                ; title string
resP at lbTitlePosition  = "Right"              ; title position
resP at lbTitleFontHeightF= .02                ; make title smaller
resP at lbTitleDirection = "Across"             ; title direction



On Wed, Aug 31, 2016 at 2:10 PM, Anahita Amiri Farahani <aamir003 at ucr.edu>
wrote:

> 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
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160901/4eb1057d/attachment.html 


More information about the ncl-talk mailing list