[ncl-talk] LabelBar Positioning

Mary Haley haley at ucar.edu
Thu Oct 15 10:35:41 MDT 2015


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151015/675d1912/attachment.html 


More information about the ncl-talk mailing list