Two plot templates categories (cylindrical
and polar stereographic
projections) come with "nice" lat/lon labels. These have been manually
added by the developers.
In NCL version 4.2.0.a23, some built in tickmarks have been added to
the language. To get these tickmarks, you need to set pmTickMarkDisplayMode = "Always". Not all
of the tick mark resources are
available for maps.
: Demonstrates the
default tickmarks of a cylindrical equidistant plot.
: Turns on the
tickmarks available in NCL version 4.2.0.a23 and later.
pmTickMarkDisplayMode = "Always"
will turn on these tickmarks.
The built-in tickmarks contain a degree symbol.
: Demonstrates what
happens to the built-in tickmarks when you zoom in to less than one
: Demonstrates how to
change the tickmark label font height, adjust the tickmark length,
and turn on grid lines (a map resource). This works for both the
default and built-in tickmarks.
tmXBLabelFontHeightF and its
relatives (XT,YL etc) adjust the font height of tickmark labels.
tmXBMajorLengthF and adjusts the
tickmark length. The plot template is designed such that changing one
tickmark length (e.g. XB), changes them all.
mpGridAndLimbOn turns on the grid
lines. This is a function of the map and not tickmarks. Note that
there are numerous other mpGrid* resources that control its spacing
how to change the default "0" to a "EQ"
To do this change, you must explicitly define the tickmarks and their
tmXBLabels = (/.../)
how to get a degree symbol in the map tickmark labels, and how to
turn on labels for the top and right axes.
You must first explicitly define the tickmarks and their labels as
defined in example 6 above, and then use text function codes
to get a degree symbol. Set tmXTLabelsOn and tmYRLabelsOn to True to get tickmark labels
on the top and right axes. Note that setting pmTickMarkDisplayMode = "Always" will
also have the effect of giving you map tickmark labels with degree
symbols (see example 2).
how to change the labels on a cylindrical equidistant map.
This method only works for CE maps!
To do this change, you must explicitly define the bottom tickmarks and
their labels using:
tmXBLabels = (/.../).
Ditto for the right Y labels using:
tmYLMode = "Explicit"
tmYLValues = (/.../)
tmYLLabels = (/.../)
In this example, the "F" function code is
being used to switch to the Greek
font table (font table 33) in order to get the "pi" symbol.
how to explicitly label the axes with the tickmarks and labels
you want. You can use this for rectangular map projections only.
To use, copy the "add_map_tickmarks" function to your own code,
and then set the locations where you want tickmarks by
setting one or more of these resources:
res@tmYLValues = ...
res@tmYRValues = ...
res@tmXBValues = ...
res@tmXTValues = ...
: Shows how to add your
own longitude/latitude labels to a masked Lambert Conformal plot.
function is used to attach the labels. The
angle of the strings is calculated by converting lat/lon values to NDC
) and then
to get the angle.
how to explicitly label map tickmarks with degrees-minutes-seconds
type of labels. This example only works for
cylindrical equdistant maps.
If you want to do something like this for other map projections see
examples 9 and 10. You will have to change the corresponding
adding tickmarks to a Robinson map.
The gsn_add_text function is used to attach the
labels. No labels are added at lat = abs(90) or lon = abs(180).
Extra spacing is added after the left labels, and before the
right labels so they don't run into the map.