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

Adam Phillips asphilli at ucar.edu
Tue May 22 14:32:02 MDT 2018


Hi Anahita,
Looking at your output and the script I do not see what is wrong. Can you
respond to ncl-talk with what is wrong with the plot and what error
messages you are getting?
Adam

On Tue, May 22, 2018 at 2:20 PM, Anahita Amiri Farahani <aamir003 at ucr.edu>
wrote:

> Dear Adam,
>
> Thanks for your help, I tried to apply what you suggested but got a bunch
> of warnings and for the last plot did not work, I've attached the code and
> plot here.
>
> On Mon, May 21, 2018 at 3:14 PM, Adam Phillips <asphilli at ucar.edu> wrote:
>
>> Hi Anahita,
>> Change this:
>> res at lbLabelBarOn        = False           ; turn off individual cb's
>> to this:
>> res at lbLabelBarOn        = True          ; turn off individual cb's
>>
>> and change this:
>>  resP at gsnPanelLabelBar = True
>> to this:
>>  resP at gsnPanelLabelBar = False
>>
>> If you need titles for your labelbars you can use the same resources in
>> resP but apply them to res. Thus:
>> res at lbTitleString    = "%"                ; title string
>> res at lbTitlePosition  = "Right"              ; title position
>> res at lbTitleFontHeightF= .02                ; make title smaller
>> res at lbTitleDirection = "Across"             ; title direction
>>
>> Hope that helps. If you have any further queries please respond to
>> ncl-talk.
>> Adam
>>
>> On Fri, May 18, 2018 at 12:33 PM, Anahita Amiri Farahani <
>> aamir003 at ucr.edu> wrote:
>>
>>> 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
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>>
>> --
>> Adam Phillips
>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>
>> <http://www.cgd.ucar.edu/staff/asphilli>
>>
>
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180522/d81a3c28/attachment.html>


More information about the ncl-talk mailing list