[ncl-talk] producing label bars with a given width and height

Mary Haley haley at ucar.edu
Thu Mar 17 08:27:48 MDT 2016


Hi Emanuele,

The labelbar is admittedly hard to control sometimes.  When you turn on a
labelbar for a plot (versus creating from scratch yourself), the plot is
trying to control some features of it so that the width, height, and the
labels are sized relative to the plot.

If you need to have a fixed labelbar size, then I suggest creating the
labelbar yourself from scratch using.  This can be a bit of a pain, but
once you have it, you can use the code over again for other plots. Also, we
have lots of examples to help you with this.

As a start, see "lb_19.ncl" at

http://www.ncl.ucar.edu/Applications/labelbar.shtml#ex19

which you should be able to download and run as-is.  It shows how to
recreate a labelbar from a given plot (see the "contour_labelbar"
procedure).

You could try this procedure and see if it gives you the labelbar you want.
You can also modify the procedure to override any labelbar settings to
whatever you want. For example, you can change the width and the height by
changing these two lines:

;---Set width and height of labelbar itself

  lbres at vpHeightF            = lbar_h
  lbres at vpWidthF             = lbar_w

To control the location of the labelbar, change these two values:

lbar_x
lbar_y

and so on. If you have any trouble with this procedure, please post back to
ncl-talk and let us know.

Good luck,

--Mary


On Sun, Mar 13, 2016 at 12:41 PM, Alan Brammer <abrammer at albany.edu> wrote:

> Without seeing an actual NCL script and how you’re plotting it’s hard to
> guess.
> But have you looked at the label bar examples?
>
> Initial resources you could set, taken from lb_5.ncl
> https://www.ncl.ucar.edu/Applications/labelbar.shtml:
>
>  res at pmLabelBarWidthF      = 0.4               ; default is shorter
>  res at pmLabelBarHeightF     = 0.1               ; default is taller
>
>
>
> Alan
>
>
> ##############################
> Alan Brammer,
> Post-Doc Researcher
>
> Department of Atmospheric and Environmental Sciences,
> University at Albany, State University of New York, Albany, NY, 12222
> abrammer at albany.edu
> ##############################
>
> On 10 Mar 2016, at 04:29, emanuele lombardi <emanuele.lombardi at enea.it>
> wrote:
>
> Dear NCL-ers,
>
> I'm putting my ncl plots over Google Maps and I'm very happy with that.
> I give Google Map my plot as a Ground Overlay and the labelbar as a
> "control element" [ by means of
>  map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(myControlDiv) ]
>
> My problem is that labelbars of my plots grately varies in size from plot
> to plot, thus their posizion and size varies in the resulting Google Map.
> And this is not good.
>
> Thus my question is: whichever the number of "colors" there will be in the
> label bar, is it possible to have the label bar of a given size (in term of
> pixel)?
>
> I use  res at lbAutoManage = False
>
> Thank you very much for any help,
> Regards,
> Emanuele
>
>
>
> --
> Emanuele Lombardi
> ENEA Casaccia
> I-00123 Roma (RM)
> tel. +39 0630483366
> http://utmea.enea.it/people/lombardi
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160317/cd578dca/attachment.html 


More information about the ncl-talk mailing list