Hi Adam,<div style="font-size: 12pt; font-family: Arial;"><p><br></p><p style="font-size: 12pt; font-family: Arial;">Thanks for the suggestion. I wasn't familiar with lbLabelAlignment. I adapted the last part of <span style="font-size: 12pt; font-family: Arial;">https://www.ncl.ucar.edu/Applications/Scripts/lb_14.ncl</span><span style="font-size: 12pt; font-family: Arial;"> in the </span><span style="font-size: 12pt; font-family: Arial;">add_labelbar function. Now it looks like below, although I'm getting an error message.</span></p><p style="font-size: 12pt; font-family: Arial;"><span style="font-size: 12pt; font-family: Arial;"><br></span></p><p><span style="font-size: 12pt; font-family: Arial;">fatal:["NclAtt.c":262]:Attribute assignment type mismatch.</span></p><p style="font-size: 12pt; font-family: Arial;"><span style="font-size: 12pt; font-family: Arial;"><br></span></p><p style="font-size: 12pt; font-family: Arial;"><span style="font-size: 12pt; font-family: Arial;">I don't know from which part of the function the message is coming. The labelbar is correctly changed despite the message.</span></p><p style="font-size: 12pt; font-family: Arial;"><span style="font-size: 12pt; font-family: Arial;"><br></span></p><p style="font-size: 12pt; font-family: Arial;"><span style="font-size: 12pt; font-family: Arial;">Cheers,</span></p><p style="font-size: 12pt; font-family: Arial;"><span style="font-size: 12pt; font-family: Arial;">Giorgio</span></p><p style="font-size: 12pt; font-family: Arial;"><span style="font-size: 12pt; font-family: Arial;"><br></span></p><p><span style="font-size: 12pt;">undef("add_labelbar")</span></p><p><span style="font-size: 12pt;">procedure add_labelbar(wks,plot,cmap,labels,stride,title,location)</span></p><p><span style="font-size: 12pt;">local nboxes, nlabel, vph, vpw, lbres, lbid, amres, annoid</span></p><p><span style="font-size: 12pt;">begin</span></p><p><span style="font-size: 12pt;">  nlabel = dimsizes(labels)</span></p><p><span style="font-size: 12pt;">  nboxes = dimsizes(labels)+1  </span></p><p><span style="font-size: 12pt;">  colors = span_color_rgba(cmap,nboxes)</span></p><p><span style="font-size: 12pt;">  getvalues plot                      ; Get plot size for use in</span></p><p><span style="font-size: 12pt;">    "vpHeightF" : vph                 ; creating labelbar.</span></p><p><span style="font-size: 12pt;">    "vpWidthF"  : vpw</span></p><p><span style="font-size: 12pt;">  end getvalues</span></p><p><span style="font-size: 12pt;">;</span></p><p><span style="font-size: 12pt;">; Set some resources for a vertical or horizontal labelbar on the</span></p><p><span style="font-size: 12pt;">; bottom or right axis. </span></p><p><span style="font-size: 12pt;">;</span></p><p><span style="font-size: 12pt;">; am_para/am_orth</span></p><p><span style="font-size: 12pt;">;    0.0/ 0.0  -  annotation in dead center of plot</span></p><p><span style="font-size: 12pt;">;    0.5/ 0.5  -  annotation at bottom right of plot</span></p><p><span style="font-size: 12pt;">;    0.5/-0.5  -  annotation at top right of plot</span></p><p><span style="font-size: 12pt;">;   -0.5/-0.5  -  annotation at top left of plot</span></p><p><span style="font-size: 12pt;">;   -0.5/ 0.5  -  annotation at bottom left of plot</span></p><p><span style="font-size: 12pt;">;                                                                  </span></p><p><span style="font-size: 12pt;">; You will likely need to modify the am_para/am_orth </span></p><p><span style="font-size: 12pt;">; values depending on your X and Y axis labels, the size</span></p><p><span style="font-size: 12pt;">; of your plot, the number of rows and columns you have, et.</span></p><p><span style="font-size: 12pt;">;</span></p><p><span style="font-size: 12pt;">  if(any(location.eq.(/"bot1","bot2"/))) then</span></p><p><span style="font-size: 12pt;">    orient  = "horizontal"    </span></p><p><span style="font-size: 12pt;">    width   = vpw * 0.95   ; slightly shorter than width of plot</span></p><p><span style="font-size: 12pt;">    height  = vph * 0.15</span></p><p><span style="font-size: 12pt;">    am_just = "BottomCenter"</span></p><p><span style="font-size: 12pt;">    am_para = 0.0         ; Centered about X axis</span></p><p><span style="font-size: 12pt;">    title_pos = "Top"</span></p><p><span style="font-size: 12pt;">    if(location.eq."bot1")</span></p><p><span style="font-size: 12pt;">      am_orth = 0.85       ; Move labelbar down</span></p><p><span style="font-size: 12pt;">    else</span></p><p><span style="font-size: 12pt;">      am_orth = 1.04       ; Move further down</span></p><p><span style="font-size: 12pt;">    end if </span></p><p><span style="font-size: 12pt;">  else</span></p><p><span style="font-size: 12pt;">    orient  = "vertical"</span></p><p><span style="font-size: 12pt;">    width   = vpw * 0.15</span></p><p><span style="font-size: 12pt;">    height  = vph * 0.95    ; Slightly shorter than height of plot</span></p><p><span style="font-size: 12pt;">    am_just = "TopLeft"</span></p><p><span style="font-size: 12pt;">    am_orth = -0.5          ; Move labelbar up</span></p><p><span style="font-size: 12pt;">    title_pos = "Left"</span></p><p><span style="font-size: 12pt;">    if(location.eq."rgt2")</span></p><p><span style="font-size: 12pt;">      am_para = 0.55        ; Move labelbar right</span></p><p><span style="font-size: 12pt;">    else</span></p><p><span style="font-size: 12pt;">      am_para = 0.78        ; Move further right</span></p><p><span style="font-size: 12pt;">    end if </span></p><p><span style="font-size: 12pt;">  end if</span></p><p><span style="font-size: 12pt;">; labelbar resources</span></p><p><span style="font-size: 12pt;">  lbres                    = True          </span></p><p><span style="font-size: 12pt;">  lbres@lbAutoManage       = False         ; Necessary to control sizes</span></p><p><span style="font-size: 12pt;">  lbres@vpWidthF           = width</span></p><p><span style="font-size: 12pt;">  lbres@vpHeightF          = height</span></p><p><span style="font-size: 12pt;">  lbres@lbFillColors       = colors        ; Labelbar colors</span></p><p><span style="font-size: 12pt;">  lbres@lbMonoFillPattern  = True          ; Solid fill pattern</span></p><p><span style="font-size: 12pt;">  lbres@lbLabelFontHeightF = 0.015         ; Font height, default is small</span></p><p><span style="font-size: 12pt;">;  lbres@lbLabelAlignment   = "InternalEdges"</span></p><p><span style="font-size: 12pt;">  lbres@lbOrientation      = orient</span></p><p><span style="font-size: 12pt;">  lbres@lbTitleString      = title</span></p><p><span style="font-size: 12pt;">  lbres@lbPerimOn          = False</span></p><p><span style="font-size: 12pt;">  lbres@lbTitlePosition    = title_pos</span></p><p><span style="font-size: 12pt;">  lbres@lbLabelStride      = stride</span></p><p><span style="font-size: 12pt;">; this part is to exclude the boxes outside the range of labels (adapted from https://www.ncl.ucar.edu/Applications/Scripts/lb_14.ncl) </span></p><p><span style="font-size: 12pt;">  lbres@lbLabelAlignment   = "ExternalEdges"</span></p><p><span style="font-size: 12pt;">  labels_plus              = new(nlabel+2,typeof(labels),labels@_FillValue)</span></p><p><span style="font-size: 12pt;">  labels_plus(1:nlabel)    = labels</span></p><p><span style="font-size: 12pt;">  labels_plus(0)           = labels(0)</span></p><p><span style="font-size: 12pt;">  labels_plus(nlabel+1)    = labels(nlabel-1)</span></p><p><span style="font-size: 12pt;">  lbres@lbLabelStrings     = sprintf("%5.1f",labels_plus)</span></p><p><span style="font-size: 12pt;">  </span></p><p><span style="font-size: 12pt;">  lbid = gsn_create_labelbar(wks,nboxes,labels_plus,lbres)</span></p><p><span style="font-size: 12pt;">; annotation resources</span></p><p><span style="font-size: 12pt;">  amres                  = True</span></p><p><span style="font-size: 12pt;">  amres@amJust           = am_just</span></p><p><span style="font-size: 12pt;">  amres@amOrthogonalPosF = am_orth</span></p><p><span style="font-size: 12pt;">  amres@amParallelPosF   = am_para</span></p><p><span style="font-size: 12pt;">; attach the labelbar to the plot</span></p><p><span style="font-size: 12pt;">  plot@annoid = gsn_add_annotation(plot,lbid,amres)</span></p><p><span style="font-size: 12pt; font-family: Arial;">end</span></p><br><br>        <br>        <blockquote><br>        <br>   ------ Messaggio Originale ------<br>   Da: asphilli@ucar.edu<br>   A: g.graffino@tim.it<br>Cc: ncl-talk@ucar.edu<br>   Inviato: martedì 4 ottobre 2022 17:53<br>   Oggetto: Re: [ncl-talk] ExcludeOuterBoxes in gsn_create_labelbar<br>  <br>        <div dir="ltr">Hi Giorgio,<div style="font-size: 12pt; font-family: Arial;">You can try setting lbLabelAlignment to "ExternalEdges" which I believe will produce the same results as cnLabelBarEndStyle. See example #14 here:</div><div><a href="https://www.ncl.ucar.edu/Applications/labelbar.shtml#ex14" target="_blank">https://www.ncl.ucar.edu/Applications/labelbar.shtml#ex14<br></a></div><div>Or see many other examples where this resource is set:</div><div><a href="https://www.ncl.ucar.edu/Applications/res_list.shtml#lbLabelAlignment" target="_blank">https://www.ncl.ucar.edu/Applications/res_list.shtml#lbLabelAlignment</a><br><br></div><div>Hope that helps!</div><div>Adam</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 28, 2022 at 1:22 PM Giorgio Graffino via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex; --darkreader-inline-border-left:#3e4446;" data-darkreader-inline-border-left=""><p style="font-size: 12.0pt;font-family: Arial;"><span style="font-family: Arial;font-size: 12.0pt;">Dear NCL Community,</span></p><p style="font-size: 12.0pt;font-family: Arial;"><span style="font-family: Arial;font-size: 12.0pt;"><br></span></p><p style="font-size: 12.0pt;font-family: Arial;"><span style="font-family: Arial;font-size: 12.0pt;">I'm trying to set the resource </span><span style="font-size: 12.0pt;font-family: Arial;">cnLabelBarEndStyle to "</span><span style="font-size: 12.0pt;font-family: Arial;">ExcludeOuterBoxes</span><span style="font-size: 12.0pt;font-family: Arial;">" while calling </span><span style="font-size: 12.0pt;font-family: Arial;">gsn_create_labelbar, to get ride of the labelbar boxes bigger than 1 and smaller than -1 in the attached plot. However, since I'm not drawing a contour plot, the resource doesn't do anything. I'm adapting this example (</span><span style="font-size: 12.0pt;font-family: Arial;"><a href="https://www.ncl.ucar.edu/Applications/Scripts/table_8.ncl" target="_blank">https://www.ncl.ucar.edu/Applications/Scripts/table_8.ncl</a></span><span style="font-size: 12.0pt;font-family: Arial;">). The procedure drawing the labelbar is shown below. </span></p><p style="font-size: 12.0pt;font-family: Arial;"><span style="font-size: 12.0pt;font-family: Arial;"><br></span></p><p style="font-size: 12.0pt;font-family: Arial;"><span style="font-size: 12.0pt;font-family: Arial;">How can I solve the issue? I tried to look for a solution in the quick search bar in </span><span style="font-family: arial , sans-serif;font-size: 12.0pt;"><a href="https://www.ncl.ucar.edu/Support/posting_guidelines.shtml" target="_blank">https://www.ncl.ucar.edu/Support/posting_guidelines.shtml</a>, but it's always giving me the following error "</span><span style="font-family: arial , sans-serif;font-size: 12.0pt;">The requested page could not be found.</span><span style="font-family: arial , sans-serif;font-size: 12.0pt;">"</span></p><p style="font-size: 12.0pt;font-family: Arial;"><span style="font-family: arial , sans-serif;font-size: 12.0pt;"><br></span></p><p style="font-size: 12.0pt;font-family: Arial;"><span style="font-family: arial , sans-serif;font-size: 12.0pt;">Cheers,</span></p><p style="font-size: 12.0pt;font-family: Arial;"><span style="font-family: arial , sans-serif;font-size: 12.0pt;">Giorgio</span></p><p style="font-size: 12.0pt;font-family: Arial;"><span style="font-size: 12.0pt;font-family: Arial;"><br></span></p><p><span style="font-family: Arial;font-size: 12.0pt;">undef("add_labelbar")</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">procedure add_labelbar(wks,plot,cmap,labels,stride,title,location)</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">local nboxes, vph, vpw, nboxes, lbres, lbid, amres, annoid</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">begin</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  nboxes = dimsizes(labels)+1  </span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  colors = span_color_rgba(cmap,nboxes)</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  getvalues plot                      ; Get plot size for use in</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    "vpHeightF" : vph                 ; creating labelbar.</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    "vpWidthF"  : vpw</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  end getvalues</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">;</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">; Set some resources for a vertical or horizontal labelbar on the</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">; bottom or right axis. </span></p><p><span style="font-family: Arial;font-size: 12.0pt;">;</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">; am_para/am_orth</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">;    0.0/ 0.0  -  annotation in dead center of plot</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">;    0.5/ 0.5  -  annotation at bottom right of plot</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">;    0.5/-0.5  -  annotation at top right of plot</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">;   -0.5/-0.5  -  annotation at top left of plot</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">;   -0.5/ 0.5  -  annotation at bottom left of plot</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">;                                                                  </span></p><p><span style="font-family: Arial;font-size: 12.0pt;">; You will likely need to modify the am_para/am_orth </span></p><p><span style="font-family: Arial;font-size: 12.0pt;">; values depending on your X and Y axis labels, the size</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">; of your plot, the number of rows and columns you have, et.</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">;</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  if(any(location.eq.(/"bot1","bot2"/))) then</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    orient  = "horizontal"    </span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    width   = vpw * 0.95   ; slightly shorter than width of plot</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    height  = vph * 0.15</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    am_just = "BottomCenter"</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    am_para = 0.0         ; Centered about X axis</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    title_pos = "Top"</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    if(location.eq."bot1")</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">      am_orth = 0.85       ; Move labelbar down</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    else</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">      am_orth = 1.04       ; move further down</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    end if </span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  else</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    orient  = "vertical"</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    width   = vpw * 0.15</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    height  = vph * 0.95    ; slightly shorter than height of plot</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    am_just = "TopLeft"</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    am_orth = -0.5          ; Move labelbar up</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    title_pos = "Left"</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    if(location.eq."rgt2")</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">      am_para = 0.55        ; Move labelbar right</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    else</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">      am_para = 0.78        ; move further right</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">    end if </span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  end if</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">; labelbar resources</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  lbres                    = True          </span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  lbres@lbAutoManage       = False         ; Necessary to control sizes</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  lbres@vpWidthF           = width</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  lbres@vpHeightF          = height</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  lbres@cnLabelBarEndStyle = "ExcludeOuterBoxes"</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  lbres@lbFillColors       = colors        ; labelbar colors</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  lbres@lbMonoFillPattern  = True          ; Solid fill pattern</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  lbres@lbLabelFontHeightF = 0.015          ; font height. Default is small</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  lbres@lbLabelAlignment   = "InteriorEdges"</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  lbres@lbOrientation      = orient</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  lbres@lbTitleString      = title</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  lbres@lbPerimOn          = False</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  lbres@lbTitlePosition    = title_pos</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  lbres@lbLabelStride      = stride</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  lbid = gsn_create_labelbar(wks,nboxes,labels,lbres)</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">; annotation resources</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  amres                  = True</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  amres@amJust           = am_just</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  amres@amOrthogonalPosF = am_orth</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  amres@amParallelPosF   = am_para</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">; attach the labelbar to the plot</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">  plot@annoid = gsn_add_annotation(plot,lbid,amres)</span></p><p><span style="font-family: Arial;font-size: 12.0pt;">end</span></p>_______________________________________________<br> ncl-talk mailing list<br> <a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br> List instructions, subscriber options, unsubscribe:<br> <a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br> </blockquote></div><br><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888" data-darkreader-inline-color="" style="--darkreader-inline-color:#9d9488;">Adam Phillips <br></font></span></div><span><font color="#888888" data-darkreader-inline-color="" style="--darkreader-inline-color:#9d9488;">Associate Scientist IV, Climate Analysis Section</font></span></div><div><span><font color="#888888" data-darkreader-inline-color="" style="--darkreader-inline-color:#9d9488;">Climate and Global Dynamics Laboratory<br></font></span></div></div><div><span style="color: rgb(136, 136, 136); --darkreader-inline-color:#9d9488;" data-darkreader-inline-color="">National Center for Atmospheric Research</span><span><font color="#888888" data-darkreader-inline-color="" style="--darkreader-inline-color:#9d9488;"><br></font></span></div><div><span><font color="#888888" data-darkreader-inline-color="" style="--darkreader-inline-color:#9d9488;"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> </font></span></div><span><font color="#888888" data-darkreader-inline-color="" style="--darkreader-inline-color:#9d9488;"></font></span><div><div><span><font color="#888888" data-darkreader-inline-color="" style="--darkreader-inline-color:#9d9488;"><br></font></span><div><span><font color="#888888" data-darkreader-inline-color="" style="--darkreader-inline-color:#9d9488;"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div> <br>        </blockquote><br>        <br>        </div>