Home
Manual
Packages
Global Index
Keywords
Quick Reference
|
3.5.4 Ticks and labels
The style parameters regulating the location of the viewport,
appearance of the tick marks, and so on are fairly straightforward:
You can specify which of the four sides of the viewport will have
tick marks, or you can select "axis" style, where coordinate axes
and ticks run through the middle of the viewport. Tick marks can
extend into or out of the viewport, or both (beware that tick marks
which project into the viewport often overlay a portion of your data,
making it harder to interpret). You can draw a frame line around the
edge of the viewport, or just let the tick marks frame your picture.
You can specify which, if any, of the four sides of the viewport will
have numeric labels for the ticks, the distance from the ticks to the
labels, the font and size of the labels, and so forth.
An elaborate artificial intelligence (or stupidity) algorithm
determines tick and label positions. Four parameters control this
algorithm: nMajor, nMinor, logAdjMajor, and logAdjMinor. Tick marks
have a hierarchy of lengths. The longest I call major ticks; these
are the tick marks which get a numeric label (if you turn on labels).
Like the scale on a ruler, there is a hierarchy of progressively
shorter ticks. Each level in the hierarchy divides the intervals
between the next higher level into two or five subdivisions -- two if
the interval above had a width whose least significant decimal digit
of 1 or 2, five if that digit was 5.
Only two questions remain: What interval should I use for the major
ticks, and how many levels should I proceed down the hierarchy? The
nMajor and nMinor parameters answer these questions. They specify the
upper limit of the density of the largest and smallest ticks in the
hierarchy, respectively, as follows: The tick interval is the smallest
interval such that the ratio of the full interval plotted to that
interval is less than nMajor (or nMinor). Only major tick intervals
whose widths have least significant decimal digit 1, 2, or 5 are
considered (otherwise, the rest of the hierarchy algorithm fails).
Log scaling adds two twists: First, if there are any decades, I make
decade ticks longer than any others, even if the first level of
subdecade ticks are far enough apart to get numeric labels. If there
will be ticks within each decade, I divide the decade into three
subintervals -- from 1 to 2, 2 to 5, and 5 to 10 -- then use the
linear scale algorithm for selecting tick intervals at the specified
density within each of the three subintervals. Since the tick density
changes by at most a factor of 2.5 within each subinterval, the linear
algorithm works pretty well. You expect closer ticks on a log scale
than you see on a linear scale, so I multiply the nMajor and nMinor
densities by logAdjMajor and logAdjMinor before using them for the
subintervals.
A final caveat: On the horizontal axis, long numeric labels can
overlap each other if the tick density gets too high. This depends on
the font size and the maximum number of digits you allow for those
labels, both of which are style parameters. Designing a graphics
style which avoids this evil is not easy.
|