<div dir="ltr">I don&#39;t know for certain, but you might try adding <div><br></div><div>   resP@lbBoxCount = 5</div><div><br></div><div>I&#39;m not positive that will fix it, but the docs say that the sizes of arrays like lbLabelStrings, etc, must match the lbBoxCount, and in your case it sounds like its defaulting to 11 (?)</div><div><br></div><div>Hope that helps...</div><div>Rick </div><div>    </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 21, 2016 at 2:12 AM, Beata Szabo <span dir="ltr">&lt;<a href="mailto:szabo.b@czechglobe.cz" target="_blank">szabo.b@czechglobe.cz</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I created a panel plot with my own netCDF files and color table be created<br>
according to<br>
<a href="http://www.ncl.ucar.edu/Document/Graphics/create_color_table.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/<wbr>Document/Graphics/create_<wbr>color_table.shtml</a><br>
<br>
My own color table has ncolors = 5. The netCDF files contains five float<br>
values (1.0, 2.0, 3.0, 4.0, 5.0). After I run the below script I received<br>
correct maps with incorrect labelbar. The labelbar containes 11 box where<br>
the first two and the last two colors are two times and the third color<br>
roles three times. Moreover the label strings are the follows: Arid,<br>
Sub-humid, Label_6, Label_8.<br>
<br>
How can I create a correct labelbar?<br>
<br>
;-----------------------------<wbr>------------------------------<wbr>-----------<br>
; Main code.<br>
;-----------------------------<wbr>------------------------------<wbr>-----------<br>
begin<br>
;*****************************<wbr>*******************<br>
; read in netCDF file<br>
;*****************************<wbr>*******************<br>
  a = addfile(&quot;UNEP_E-OBS_sm.nc&quot;,&quot;r&quot;<wbr>)<br>
  b = addfile(&quot;UNEP_1971-2000_sm.nc&quot;<wbr>,&quot;r&quot;)<br>
  c = addfile(&quot;UNEP_2021-2050_sm.nc&quot;<wbr>,&quot;r&quot;)<br>
  d = addfile(&quot;UNEP_2071-2100_sm.nc&quot;<wbr>,&quot;r&quot;)<br>
<br>
  un1 = a-&gt;unep(:,:)<br>
  un2 = b-&gt;unep(:,:)<br>
  un3 = c-&gt;unep(:,:)<br>
  un4 = d-&gt;unep(:,:)<br>
<br>
  minlat             =  30                ; min lat to mask<br>
  maxlat             =  75                ; max lat to mask<br>
  minlon             = -20                ; min lon to mask<br>
  maxlon             =  40                ; max lon to mask<br>
<br>
;*****************************<wbr>*******************<br>
; create plot<br>
;*****************************<wbr>*******************<br>
  wks = gsn_open_wks(&quot;png&quot;,&quot;unep&quot;)            ; send graphics to PNG file<br>
<br>
  cmap = read_colormap_file(&quot;aridity&quot;)<br>
<br>
<br>
<br>
  plot = new(4,graphic)<br>
  res                       = True              ; plot mods desired<br>
  res@gsnMaximize           = True              ; enlarge plot<br>
  res@gsnDraw               = False             ; Don&#39;t draw yet<br>
  res@gsnFrame              = False             ; Don&#39;t advance frame yet<br>
  res@mpProjection          = &quot;LambertConformal&quot;; choose projection<br>
<br>
  res@cnFillOn              = True              ; turn on color<br>
  res@cnLinesOn             = False             ; turn off contour lines<br>
  res@lbLabelBarOn          = False<br>
  res@cnFillPalette         = cmap(::-1,:)         ; set color map<br>
<br>
  res@mpMinLatF             = minlat<br>
  res@mpMaxLatF             = maxlat<br>
<br>
  res@mpMinLonF             = minlon<br>
  res@mpMaxLonF             = maxlon<br>
<br>
  res@gsnMaskLambertConformal = True            ; turn on lc masking<br>
  res@mpGridAndLimbOn         = True<br>
  res@mpGridLatSpacingF       = 10<br>
  res@mpGridLonSpacingF       =  5<br>
  res@gsnAddCyclic            = False<br>
<br>
  res@tiMainString            = &quot;&quot;<br>
  res@tiMainOffsetYF          = 0.01   ; Move title up a little<br>
  res@gsnRightString          = &quot;A&quot;<br>
  res@gsnLeftString           = &quot;&quot;<br>
;  pr&amp;lon = pr&amp;lon-180                             ; make lon go -180 to 180<br>
<br>
  plot(0)  =<br>
gsn_csm_contour_map(wks,un1({<wbr>minlat:maxlat},{minlon:maxlon}<wbr>),res);<br>
create plot<br>
<br>
  resb                       = True              ; plot mods desired<br>
  resb@gsnMaximize           = True              ; enlarge plot<br>
  resb@gsnDraw               = False             ; Don&#39;t draw yet<br>
  resb@gsnFrame              = False             ; Don&#39;t advance frame yet<br>
  resb@mpProjection          = &quot;LambertConformal&quot;; choose projection<br>
<br>
  resb@cnFillOn              = True              ; turn on color<br>
  resb@cnLinesOn             = False             ; turn off contour lines<br>
  resb@lbLabelBarOn          = False<br>
  resb@cnFillPalette         = cmap(::-1,:)         ; set color map<br>
<br>
  resb@mpMinLatF             = minlat<br>
  resb@mpMaxLatF             = maxlat<br>
<br>
  resb@mpMinLonF             = minlon<br>
  resb@mpMaxLonF             = maxlon<br>
<br>
  resb@gsnMaskLambertConformal = True            ; turn on lc masking<br>
  resb@mpGridAndLimbOn         = True<br>
  resb@mpGridLatSpacingF       = 10<br>
  resb@mpGridLonSpacingF       =  5<br>
  resb@gsnAddCyclic            = False<br>
<br>
  resb@tiMainString            = &quot;&quot;<br>
  resb@tiMainOffsetYF          = 0.01   ; Move title up a little<br>
  resb@gsnRightString          = &quot;B&quot;<br>
  resb@gsnLeftString           = &quot;&quot;<br>
<br>
  plot(1)  =<br>
gsn_csm_contour_map(wks,un2({<wbr>minlat:maxlat},{minlon:maxlon}<wbr>),resb);<br>
create plot<br>
<br>
  resc                       = True              ; plot mods desired<br>
  resc@gsnMaximize           = True              ; enlarge plot<br>
  resc@gsnDraw               = False             ; Don&#39;t draw yet<br>
  resc@gsnFrame              = False             ; Don&#39;t advance frame yet<br>
  resc@mpProjection          = &quot;LambertConformal&quot;; choose projection<br>
  resc@cnFillOn              = True              ; turn on color<br>
  resc@cnLinesOn             = False             ; turn off contour lines<br>
  resc@lbLabelBarOn          = False<br>
  resc@cnFillPalette         = cmap(::-1,:)         ; set color map<br>
<br>
  resc@mpMinLatF             = minlat<br>
  resc@mpMaxLatF             = maxlat<br>
<br>
  resc@mpMinLonF             = minlon<br>
  resc@mpMaxLonF             = maxlon<br>
<br>
  resc@gsnMaskLambertConformal = True            ; turn on lc masking<br>
  resc@mpGridAndLimbOn         = True<br>
  resc@mpGridLatSpacingF       = 10<br>
  resc@mpGridLonSpacingF       =  5<br>
  resc@gsnAddCyclic            = False<br>
<br>
  resc@tiMainString            = &quot;&quot;<br>
  resc@tiMainOffsetYF          = 0.01   ; Move title up a little<br>
  resc@gsnRightString          = &quot;C&quot;<br>
  resc@gsnLeftString           = &quot;&quot;<br>
<br>
<br>
  plot(2)  =<br>
gsn_csm_contour_map(wks,un3({<wbr>minlat:maxlat},{minlon:maxlon}<wbr>),resc);<br>
create plot<br>
<br>
<br>
  resd                       = True              ; plot mods desired<br>
  resd@gsnMaximize           = True              ; enlarge plot<br>
  resd@gsnDraw               = False             ; Don&#39;t draw yet<br>
  resd@gsnFrame              = False             ; Don&#39;t advance frame yet<br>
  resd@mpProjection          = &quot;LambertConformal&quot;; choose projection<br>
<br>
  resd@cnFillOn              = True              ; turn on color<br>
  resd@cnLinesOn             = False             ; turn off contour lines<br>
  resd@lbLabelBarOn          = False<br>
  resd@cnFillPalette         = cmap(::-1,:)         ; set color map<br>
<br>
  resd@mpMinLatF             = minlat<br>
  resd@mpMaxLatF             = maxlat<br>
<br>
  resd@mpMinLonF             = minlon<br>
  resd@mpMaxLonF             = maxlon<br>
<br>
  resd@gsnMaskLambertConformal = True            ; turn on lc masking<br>
  resd@mpGridAndLimbOn         = True<br>
  resd@mpGridLatSpacingF       = 10<br>
  resd@mpGridLonSpacingF       =  5<br>
  resd@gsnAddCyclic            = False<br>
<br>
  resd@tiMainString            = &quot;&quot;<br>
  resd@tiMainOffsetYF          = 0.01   ; Move title up a little<br>
  resd@gsnRightString          = &quot;D&quot;<br>
  resd@gsnLeftString           = &quot;&quot;<br>
<br>
<br>
  plot(3)  =<br>
gsn_csm_contour_map(wks,un4({<wbr>minlat:maxlat},{minlon:maxlon}<wbr>),resd);<br>
create plot<br>
<br>
;---Attach latitude labels<br>
  add_lc_labels(wks,plot(0),<wbr>minlat,maxlat,minlon,maxlon)<br>
  add_lc_labels(wks,plot(1),<wbr>minlat,maxlat,minlon,maxlon)<br>
  add_lc_labels(wks,plot(2),<wbr>minlat,maxlat,minlon,maxlon)<br>
  add_lc_labels(wks,plot(3),<wbr>minlat,maxlat,minlon,maxlon)<br>
<br>
;---Drawing the plot will also draw all the attached labels.<br>
  draw(plot(0))<br>
  draw(plot(1))<br>
  draw(plot(2))<br>
  draw(plot(3))<br>
  frame(wks)<br>
   ;-- create panel plot<br>
;*****************************<wbr>*******************<br>
    resP                     = True                ; modify the panel plot<br>
<br>
    resP@gsnPanelLabelBar    = True                ; add common colorbar<br>
    resP@lbLabelFontHeightF  = 0.007               ; make labels smaller<br>
    resP@cnExplicitLabelBarLabelOn = True<br>
<br>
    resP@lbLabelStrings = (/&quot;&quot;,&quot;Hyper-arid&quot;,&quot;Arid&quot;, \<br>
           &quot;Semi-arid&quot;,&quot;Sub-humid&quot;,&quot;<wbr>Humid&quot;/)<br>
<br>
    gsn_panel(wks,plot,(/2,2/),<wbr>resP)<br>
<br>
end<br>
<br>
Thank you for your help in advance!<br>
<br>
Beata<br>
<br>
<br>
Dr. Beata Szabo-Takacs<br>
Global Change Research Institute CAS<br>
Bělidla 986/4a<br>
60300 Brno<br>
Czech Republic<br>
<br>
______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br></div>