In some cases, when you panel your plots, the contour labels will disappear even though they may show up in the original large plots. This is because when you resize a plot to fit in a panel, NCL will remove some labels that are very small contours, in order to avoid overlap. See example conLab_6.ncl below for a way to fix this.
cnLineLabelPlacementMode can be set to randomized (default), constant, or computed. Note that only the constant method makes the label part of the line so that the line is not drawn through it.
The resource cnLabelMasking has been modified (version 4.2.0.a027 or later) that allows the user to mask the contour labels. See the script for the other resources that were used.
cnLineLabelInterval determines what sequential contours are labeled. The default is every other contour line (value=2).
cnLineDashSegLenF normally controls the length of dash lines, but it also has an effect on contour labeling when cnLineLabelPlacementMode is set to constant. With this placement mode, the labels are actually part of the line, so cnLineDashSegLenF controls label spacing.
cnLineLabelBackgroundColor allows you to choose a color. The default is transparent. This resource can not be used with a cnLineLabelPlacementMode = constant.
cnLineLabelDensityF can increase or decrease the number of labels along a contour line. The default value for this resource is 0.0, no change. Values greater than 0.0 increase the number of line labels while negative values decrease the number of line labels. The resource does not work if cnLineLabelPlacementMode is set to "constant".
Not that the effect is dependent upon the data to be plotted, the format of the labels, and various other variables. Therefore, there is no general relationship between the value chosen and the number of labels. It will be plot dependent.
Plot #1 (top) shows the default NCL line labeling. Plot #2 (middle) uses cnLineLabelDensityF to increase the number of line labels, and cnLineLabelInterval to label every line instead of the default every other line. Plot #3 (bottom) uses cnLabelMasking to wipe out the contour line behind each line label, thereby making the line labels easier to read.
First the plot is created, and getvalues is used to retrieve the contour levels via the cnLevels resource. A new "flags" array is created of the same size as the "levels" array. We loop through the levels and set this "flags" array to "LineOnly" for negative contours, and "LineAndLabel" for zero and positive contours. Finally, setvalues is used to set the cnLevelFlags resource and change the title.
The first image shows the default labels, and the second image was created by setting both cnLineLabelFormat resource and lbLabelStrings, to format both the contour line labels and the labelbar labels.
The string to use with the cnLineLabelFormat resource can be a bit confusing. See tickmark example tm_8.ncl, which illustrates the various strings you can use. These same strings can be applied for this resource.