
Example pages containing:
tips |
resources |
functions/procedures
NCL Graphics: Tick marks


trYMinF, trYMaxF, trXMinF and trXMaxF allow the user to set the minimum Y-axis value, the maximum Y-axis value, the minimum X-axis value, and the maximum X-axis value.
vpWidthF (vpHeightF) allows the user to set the width (height) of the XY plot in NDC coordinates.
The second frame shows how to force the X-axis tickmark labeling to start on the first value, by setting tmXBMode to "Manual" and tmXBTickStartF to the minimum value of the X-axis.

By default, tmXBMode is set to Automatic, automatically generating the bottom X-axis tick mark labels. For the top panel, tmXBMode is set to Manual, tmXBTickStartF, tmXBTickStartF, and tmXBTickSpacingF are then used to manually set the bottom X-axis labels.
For the bottom panel, tmXBMode is set to Explicit, and tmXBValues and tmXBLabels are used to set the bottom X-axis labels. This setting allows the user to explicitly specify labels. Note, when tmXBMode is set to Explicit, the bottom X-axis minor tick marks are automatically removed. To explicitly specify what bottom X-axis minor tick marks are shown, tmXBMinorValues must be used.
A Python version of this projection is available here.

(Top Panel) By setting tmYROn to False and tmYRBorderOn to False, the right Y-axis is completely turned off. (The right Y-axis and top X-axis labels are by default turned off.) The same is done to the top X-axis, using tmXTOn and tmXTBorderOn.
(Bottom Panel) tmXBLabelFontHeightF is used to set the bottom X-axis tick mark label font size, and tmYLLabelsOn is used to remove the left Y-axis tick mark labels.

res@gsnXRefLine = 0. res@gsnRightXRefLineColor = "White" res@gsnLeftXRefLineColor = "Gray"
This capability is only available in NCL version 6.4.0 or later.

The top panel shows the default formatting of the left Y-axis and bottom X-axis. The default setting of tmYLFormat / tmXBFormat is "0@*+^sg". For an explanation of what this means, refer to documentation of the HLU Floating Point Format Specification scheme.
For the middle panel, tmYLFormat is set to "0*+^e", which forces use of the lower case exponential format (e) for the left Y-axis tick mark labels. The precision of the bottom X-axis labels is set by setting tmXBPrecision.
For the bottom panel, tmYLFormat is set to "#+^se". This results in the + labels being shown, and a format of "x10i". (Translation: # = force a trailing decimal point, + = must show plus signs, ^s = use exponential format x10i, e = use exponential format, lower case.)

trYReverse is used to reverse the Y-axis, tmXBLabelAngleF alters the angle of the bottom X-axis labels, tmXBLabelFontColor sets the color of the bottom X-axis labels, and tmXBLabelDeltaF sets the amount the bottom X-axis labels are offset from the plot.

tmYUseLeft is by default set to True, which automatically formats the the right Y-axis the same as the left Y-axis. By setting tmYUseLeft to False, the user is allowed to specify different formatting for the right Y-axis when compared to the left Y-axis. tmYRLabelFontColor can now be used to set the right Y-axis tick mark label font color, and tmYRPrecision can be used to set the precision of the right Y-axis tick mark labels. If tmYUseLeft was set to True, tmYRLabelFontColor and tmYRPrecision would have no effect.
tmXBMajorLengthF and tmXBMajorOutwardLengthF are used to set the total length and total outward length of the bottom X-axis major tick marks. In this case, they are set to the same value, 0.021, which means that the tick marks will be 0.021 NDC units long on the outside of the tick mark border. (If tmXBMajorOutwardLengthF was set to -0.021 the tick marks would be 0.021 NDC units long on the inside of the tick mark border.)
tmXBMinorLengthF and tmXBMinorOutwardLengthF work the same way, except for the bottom X-axis minor tick marks. In this case, tmXBMinorLengthF is set to 0.008, and tmXBMinorOutwardLengthF is set to 0.015. Thus, the bottom X-axis minor tick marks will start at 0.015 NDC units away from the tick mark border, and be 0.008 NDC units long, leaving some white space between the minor tick marks and the tick mark border.
tiYAxisSide is set to Right, moving the Y-axis label to the right hand side of the plot.

The left panel shows the default linear Y-axis, along with labels on every bottom X-axis major tick mark.
The right panel shows a logorithmic Y-axis, and labels on every other bottom X-axis major tick mark. The Y-axis scale is changed by setting trYLog to True, and the labeling interval of the bottom X-axis tick marks is set via tmXBLabelStride.

For more information on formatting numeric labels, see the format conversion specification strings section.


The Celsius labels on the righthand Y-axis of the first plot were automatically created based on the Fahrenheit labels from the lefthand Y-axis. This results in awkward Celsius labels. The second plot shows how to manually set "nice" Celsius labels, along with minor tickmarks for the righthand Y-axis.



