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

Kreienkamp Frank Frank.Kreienkamp at dwd.de
Wed Dec 4 03:58:44 MST 2019


Hello,

yes your idea solved my problem (see attached plot)

Thanks
Frank

-----Ursprüngliche Nachricht-----
Von: Adam Phillips <asphilli at ucar.edu> 
Gesendet: Montag, 2. Dezember 2019 22:44
An: Kreienkamp Frank <Frank.Kreienkamp at dwd.de>
Cc: ncl-talk at ucar.edu
Betreff: Re: [ncl-talk] 2nd label of a color bar

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 <mailto: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 <mailto: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/ <http://www.cgd.ucar.edu/staff/asphilli/>    303-497-1726 


<http://www.cgd.ucar.edu/staff/asphilli> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test-2Label.png
Type: image/png
Size: 188626 bytes
Desc: Test-2Label.png
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191204/d8d37f3a/attachment-0001.png>


More information about the ncl-talk mailing list