Axes and Tick marks



next up previous contents
Next: Figure Margins Up: Graphics parameters list Previous: Graphical elements

Axes and Tick marks

Many of S's high-level plots have axes, and you can axes yourself with the low-level axis() graphics function. Axes have three main components: the axis line (line style controlled by the lty graphics parameter), the tick marks (which mark off unit divisions along the axis line) and the tick labels (which mark the units.) These components can be customised with the following graphics parameters.


lab=c(5,7,12)

The first two numbers are the desired number of tick intervals on the x and y axes respectively. The third number is the desired length of axis labels, in characters (including the decimal point.) Choosing a too-small value for this parameter may result in all tick labels being rounded to the same number!


las=1

Orientation of axis labels. 0 means always parallel to axis, 1 means always horizontal, and 2 mean always perpendicular to the axis.


mgp=c(3,1,0)

Positions of axis components. The first component is the distance from the axis label to the axis position, in text lines. The second component is the distance to the tick labels, and the final component is the distance from the axis position to the axis line (usually zero). Positive numbers measure outside the plot region, negative numbers inside.


tck=0.01

Length of tick marks, as a fraction of the size of the plotting region. When tck is small (less than 0.5) the tick marks on the x and y axes are forced to be the same size. A value of 1 gives grid lines. Negative values give tick marks outside the plotting region. Use tck=0.01 and mgp=c(1,-1.5,0) for internal tick marks.


xaxs="s"
yaxs="d"

Axis styles for the x and y axes, respectively. With styles "s" (standard) and "e" (extended) the smallest and largest tick marks always lie outside the range of the data. Extended axes may be widened slightly if any points are very near the edge. This style of axis can sometimes leave large blank gaps near the edges. With styles "i" (internal) and "r" (the default) tick marks always fall within the range of the data, however style "r" leaves a small amount of space at the edges.

Setting this parameter to "d" (direct axis) ``locks in'' the current axis and uses it for all future plots (or until the parameter is set to one of the other values above, at least.) Useful for generating series of fixed-scale plots.




next up previous contents
Next: Figure Margins Up: Graphics parameters list Previous: Graphical elements



Erik Moledor
Tue Jan 31 21:02:18 EST 1995