[ncl-talk] 2nd label of a color bar

Adam Phillips asphilli at ucar.edu
Mon Dec 2 14:44:08 MST 2019


Hi Frank,
If you are asking for a second line of labels underneath a common labelbar,
the answer is no a function does not exist, but you can draw a labelbar
twice using gsn_labelbar_ndc
<https://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_labelbar_ndc.shtml>,
moving the labels for the second labelbar downwards. Here is a snippet of
code that I have used for this:
  lbres                    = True          ; labelbar only resources
  lbres at vpWidthF           = 0.6    ; labelbar width
  lbres at vpHeightF          = 0.06    ; labelbar height
  lbres at lbFillColors       = res at cnFillPalette ; labelbar colors
  lbres at lbOrientation      = "Horizontal"     ; Default is vertical.
  lbres at lbLabelAlignment   = "InteriorEdges"  ; Default is "BoxCenters".
  lbres at lbMonoFillPattern  = True          ; Solid fill pattern
  lbres at lbLabelFontHeightF = 0.016         ; font height. default is small
  lbres at lbBoxLineColor = "gray70"
  gsn_labelbar_ndc(wks,dimsizes(res at cnLevels)+1,res at cnLevels
,0.205,0.19,lbres)

  lbres at lbLabelOffsetF = .5
  gsn_labelbar_ndc(wks,dimsizes(res at cnLevels
)+1,RoundPastDecimal(sqrt(8./res at cnLevels),2),0.205,0.17585,lbres)
  frame(wks)

Note that in the two gsn_labelbar_ndc calls, the NDC X value is the same
(.205), but the NDC y-value is adjusted so that the labelbars themselves
are exactly overlaid.
Adam


On Mon, Dec 2, 2019 at 2:01 AM Kreienkamp Frank via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Hello,
>
>
>
> is there a function to add a 2nd label line to a colorbar?
>
>
>
> As an exemple: The plot shows the temperature increase compared to a given
> time period. The values on each side of the  color bar show different time
> slice (preindustrial and last 30 years)
>
>
>
> Thanks in advance
>
> Frank
>
>
>
>
>
>
> _______________________________________________
> 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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191202/221fcf3c/attachment.html>


More information about the ncl-talk mailing list