<p><span style="font-family:Arial;font-size:12pt;">Hello NCLers,</span></p><p> </p><p><span style="font-family:Arial;font-size:12pt;">I need to draw tickmark labels with two different colors (red and blue). The script is quite complex; it uses part of https://www.ncl.ucar.edu/Applications/Scripts/table_8.ncl to draw many table plots, which become part of a panel plot (see attached HadCM3_plot_maps_cor_3.png). I can't find a resource like tmXBLabelFontColors, or something able to handle an array of colors like xyLineColors does for lines. Does anyone know if such resource exist?</span></p><p> </p><p><span style="font-family:Arial;font-size:12pt;">I tried to generate colored labels in another way. I found this example (https://www.ncl.ucar.edu/Applications/Scripts/tm_12.ncl), containing a procedure able to remove labels from a plot and redraw them. My version of the procedure is pasted below; it reads the value and the location of the labels from the plot function, and draws them again using gsn_text_ndc. I included the procedure in my script but the result is not the intended one (see attached HadCM3_plot_maps_cor_3colored.png).</span></p><p> </p><p><span style="font-family:Arial;font-size:12pt;">I found out that there is an unadvertised gsnPanelSave resource used in https://www.ncl.ucar.edu/Applications/Scripts/panel_GWLs_Rain.ncl to to keep the plots in their resized state. I think it might help. Can anyone please tell me how it works?</span></p><p> </p><p><span style="font-family:Arial;font-size:12pt;">Cheers,</span></p><p><span style="font-family:Arial;font-size:12pt;">Giorgio</span></p><p> </p><p><span style="font-family:Arial;font-size:12pt;">;----------------------------------------------------------------------</span><br><span style="font-family:Arial;font-size:12pt;">; This procedure replaces a plot's X/Y tickmark labels with custom</span><br><span style="font-family:Arial;font-size:12pt;">; labels created by drawing individual text strings </span><br><span style="font-family:Arial;font-size:12pt;">; (adapted from https://www.ncl.ucar.edu/Applications/Scripts/tm_12.ncl)</span><br><span style="font-family:Arial;font-size:12pt;">;----------------------------------------------------------------------</span><br><span style="font-family:Arial;font-size:12pt;">procedure replace_tickmark_labels(wks,plot)</span><br><span style="font-family:Arial;font-size:12pt;">local txres, xlabels, ylabels, xmin, ymin, xfonth, yfonth</span><br><span style="font-family:Arial;font-size:12pt;">begin</span><br><span style="font-family:Arial;font-size:12pt;">;---Turn off plot's X and Y tickmark labels</span><br><span style="font-family:Arial;font-size:12pt;"> setvalues plot</span><br><span style="font-family:Arial;font-size:12pt;">   "tmXBLabelsOn"  : False</span><br><span style="font-family:Arial;font-size:12pt;">   "tmYLLabelsOn"  : False</span><br><span style="font-family:Arial;font-size:12pt;"> end setvalues</span><br><span style="font-family:Arial;font-size:12pt;">   </span><br><span style="font-family:Arial;font-size:12pt;">;---Retrieve some values so we can reconstruct the labels</span><br><span style="font-family:Arial;font-size:12pt;"> getvalues plot</span><br><span style="font-family:Arial;font-size:12pt;">   "tmXBLabels"              : xlabels</span><br><span style="font-family:Arial;font-size:12pt;">   "tmYLLabels"              : ylabels</span><br><span style="font-family:Arial;font-size:12pt;">   "tmXBValues"              : xvalues</span><br><span style="font-family:Arial;font-size:12pt;">   "tmYLValues"              : yvalues</span><br><span style="font-family:Arial;font-size:12pt;">   "trXMinF"                 : xmin</span><br><span style="font-family:Arial;font-size:12pt;">   "trYMinF"                 : ymin</span><br><span style="font-family:Arial;font-size:12pt;">   "tmYLMajorOutwardLengthF" : ylength</span><br><span style="font-family:Arial;font-size:12pt;">   "tmXBMajorOutwardLengthF" : xlength</span><br><span style="font-family:Arial;font-size:12pt;">   "tmXBLabelFontHeightF"    : xfont_height</span><br><span style="font-family:Arial;font-size:12pt;">   "tmYLLabelFontHeightF"    : yfont_height</span><br><span style="font-family:Arial;font-size:12pt;"> end getvalues</span></p><p><span style="font-family:Arial;font-size:12pt;">;---Get the NDC locations for the new tickmark labels</span><br><span style="font-family:Arial;font-size:12pt;"> xvalues_ndc = new(dimsizes(xvalues),float)</span><br><span style="font-family:Arial;font-size:12pt;"> yvalues_ndc = new(dimsizes(yvalues),float)</span><br><span style="font-family:Arial;font-size:12pt;"> xmin_ndc    = new(1,float)</span><br><span style="font-family:Arial;font-size:12pt;"> ymin_ndc    = new(1,float)</span><br><span style="font-family:Arial;font-size:12pt;"> datatondc(plot,xvalues,yvalues,xvalues_ndc,yvalues_ndc)</span><br><span style="font-family:Arial;font-size:12pt;"> datatondc(plot,xmin,ymin,xmin_ndc,ymin_ndc)</span></p><p><span style="font-family:Arial;font-size:12pt;">;---Make sure the tickmark labels don't touch the tickmarks.</span><br><span style="font-family:Arial;font-size:12pt;"> xmin_ndc = xmin_ndc-(1.8*ylength)     </span><br><span style="font-family:Arial;font-size:12pt;"> ymin_ndc = ymin_ndc-(1.8*xlength)</span><br><span style="font-family:Arial;font-size:12pt;"> </span><br><span style="font-family:Arial;font-size:12pt;">;---Color the first four labels red</span><br><span style="font-family:Arial;font-size:12pt;"> txres = True</span><br><span style="font-family:Arial;font-size:12pt;"> txres@txFontColor = "Red"</span></p><p><span style="font-family:Arial;font-size:12pt;">;---Draw the first four labels</span><br><span style="font-family:Arial;font-size:12pt;"> txres@txFontHeightF         = xfont_height</span><br><span style="font-family:Arial;font-size:12pt;"> gsn_text_ndc(wks,ylabels(0:3),xmin_ndc,yvalues_ndc(0:3),txres)</span><br><span style="font-family:Arial;font-size:12pt;"> txres@txFontHeightF         = yfont_height</span><br><span style="font-family:Arial;font-size:12pt;"> gsn_text_ndc(wks,xlabels(0:3),xvalues_ndc(0:3),ymin_ndc,txres)</span></p><p><span style="font-family:Arial;font-size:12pt;">;---Color the last four labels blue</span><br><span style="font-family:Arial;font-size:12pt;"> txres@txFontColor = "Blue"</span></p><p><span style="font-family:Arial;font-size:12pt;">;---Draw the last four labels</span><br><span style="font-family:Arial;font-size:12pt;"> txres@txFontHeightF         = xfont_height</span><br><span style="font-family:Arial;font-size:12pt;"> gsn_text_ndc(wks,ylabels(4:7),xmin_ndc,yvalues_ndc(4:7),txres)</span><br><span style="font-family:Arial;font-size:12pt;"> txres@txFontHeightF         = yfont_height</span><br><span style="font-family:Arial;font-size:12pt;"> gsn_text_ndc(wks,xlabels(4:7),xvalues_ndc(4:7),ymin_ndc,txres)</span></p><p><span style="font-family:Arial;font-size:12pt;">end</span><br> </p>