[ncl-talk] LabelBar Positioning

Carl Schreck cjschrec at ncsu.edu
Fri Oct 16 11:47:14 MDT 2015


I've had similar frustrations with the pmLabelBarOrthogonalPosF... The most
common I run into is like the snippet below that produces the attached
image.

The larger tmXBLabelFontHeightF is and/or the more landscape the map is
(i.e., smaller lat range), then the more likely the labelbar is to overlap
with the labels.

It's been really hard to find any hard rules to control this.

    Carl

  in = addfile("data/olr.day.mean.nc","r")
  data  = short2flt( in->olr(0,:,:) )

;************************************************
; create plot
;************************************************
  wks = gsn_open_wks("pdf","lb_map")          ; open a ncgm file
  gsn_define_colormap(wks, "wgne15")

  res              =   True
  res at cnFillOn     =   True                ; turn on color

  res at gsnLeftString = "Default"
  contour = gsn_csm_contour_map(wks,data,res)  ; create the plot

  res at gsnLeftString = "Shorter plot"
  res at mpMinLatF = -60
  res at mpMaxLatF =  60
  contour = gsn_csm_contour_map(wks,data,res)  ; create the plot

  res at gsnLeftString = "Bigger fonts"
  res at tmXBLabelFontHeightF      = 0.03
  contour = gsn_csm_contour_map(wks,data,res)  ; create the plot

  res at gsnLeftString = "Guess we need to move the bar"
  res at pmLabelBarOrthogonalPosF      = 0.3
  contour = gsn_csm_contour_map(wks,data,res)  ; create the plot

On Thu, Oct 15, 2015 at 12:35 PM, Mary Haley <haley at ucar.edu> wrote:

> Hi Alan,
>
> The labelbar stuff drives me crazy too.  Part of the problem is that the
> "plot manager" is trying to adjust the labelbar for you so that its size
> and the size of its labels are in line with the size and shape of your
> plot.  This results in some surprising adjustments.
>
> The other issue is that the plot manager is also trying to leave room for
> a potential labelbar title and spaces between the labelbar and the labels,
> so there's a bunch of adjusting going on there too.  Even if you set the
> lbAutoManage resource to False, there are still issues.
>
> Dave Brown did a nice write-up of this through example 13 on the labelbar
> examples page:
>
> http://www.ncl.ucar.edu/Applications/labelbar.shtml#ex13
>
> This example might help you with your issue.
>
> I will try to come up with an example that shows you how to position a
> labelbar where you want it.  My guess is that this is going to require that
> you turn off the "plot manager" labelbar, and instead create your own so
> you can control it better. This would involve using gsn_create_labelbar and
> maybe gsn_add_annotation to attach it.
>
> If I don't get to this right away and you get tired of waiting for me,
> then you might want to see other examples on the labelbar page, like
> example lb_19.ncl:
>
> http://www.ncl.ucar.edu/Applications/labelbar.shtml#ex19
>
> --Mary
>
>
> On Wed, Oct 14, 2015 at 11:05 AM, Alan Brammer <abrammer at albany.edu>
> wrote:
>
>> This has frustrated me for a while and I always end up going with a trial
>> and error solution to get the job done.
>>
>> If I want to “attach” something to a corner of the plot I can usually do
>> it pretty easily.
>>
>> e.g Vector reference label:
>> vcres at vcRefAnnoZone = 0
>> vcres at vcRefAnnoJust = "TopRight"
>> vcres at vcRefAnnoParallelPosF = 0.5
>> vcres at vcRefAnnoOrthogonalPosF = -0.5
>>
>> How do I do this with a label bars?
>> pmLabelBarZone doesn’t seem to behave in the same manner as above.
>> Trial and error with pmLabelBarOrthogonalPosF is a hassle and then seems
>> to break occasionally if the plot shape changes.
>>
>>
>>
>> ;   simple script  ;  Our ramadda server should give access thru open dap
>> to anyone. (I think).
>>
>> tf = addfile("
>> http://ramadda.atmos.albany.edu:8080/repository/opendap/synth:4c8dfccb-37c5-43ff-be7b-79a7200bd6e8:LzIwMTUvdC4yMDE1LjBwNS5hbmwubmM=/entry.das
>> ","r")
>> t = tf->t(0,:,:,:)  ; time|lev|lat|lon
>>
>> wks = gsn_open_wks("x11","")
>>
>> res = True
>> res at trYMinF = 300
>> res at trYMaxF = 1000
>> res at cnFillOn = True
>> res at tmYROn = False
>> res at tmYRMode = "Automatic"
>> res at lbOrientation = "Vertical"
>> res at lbLeftMarginF = 0.   ;;  There appears to still be a margin?
>> plot = gsn_csm_pres_hgt(wks, t(:,{12.5},:), res)
>>
>> res at pmLabelBarZone = 0
>> res at pmLabelBarOrthogonalPosF = 0.5    ; Disappeared somewhere?
>> plot = gsn_csm_pres_hgt(wks, t(:,{12.5},:), res)
>>
>> res at pmLabelBarOrthogonalPosF = -0.01    ;  how to guess this number or
>> better way to do it?
>> plot = gsn_csm_pres_hgt(wks, t(:,{12.5},:), res)
>>
>>
>>
>> Alan.
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>


-- 

<http://www.cicsnc.org/>
<http://www.researcherid.com/rid/B-8711-2011>
* Cyclone <http://www.cyclonecenter.org/>*Center.org
<http://www.cyclonecenter.org/>  *Carl J. Schreck III, PhD*
*Research Associate*
Cooperative Institute for Climate and Satellites NC (CICS-NC)
<http://www.cicsnc.org/> /
North Carolina Institute for Climate Studies (NCICS)
<http://www.cicsnc.org/>
North Carolina State University <http://ncsu.edu/>
NOAA National Centers for Environmental Information (NCEI)
<http://ncei.noaa.gov/>
151 Patton Ave, Asheville, NC 28801
e: cjschrec at ncsu.edu
o: +1 828 257 3140
Publications
<http://scholar.google.com/citations?hl=en&user=th8ONEcAAAAJ&view_op=list_works&sortby=pubdate>
monitor.cicsnc.org/mjo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151016/b6ca00ec/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lb_map.pdf
Type: application/pdf
Size: 993930 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151016/b6ca00ec/attachment-0001.pdf 


More information about the ncl-talk mailing list