panel.axis: Panel Function for Drawing Axis Ticks and Labels

View source: R/axis.R

G_panel.axisR Documentation

Panel Function for Drawing Axis Ticks and Labels


panel.axis is the function used by lattice to draw axes. It is typically not used by users, except those wishing to create advanced annotation. Keep in mind issues of clipping when trying to use it as part of the panel function. current.panel.limits can be used to retrieve a panel's x and y limits.


panel.axis(side = c("bottom", "left", "top", "right"),
           labels = TRUE,
           draw.labels = TRUE,
           check.overlap = FALSE,
           outside = FALSE,
           ticks = TRUE,
           half = !outside,
           tck = as.numeric(ticks),
           rot = if (is.logical(labels)) 0 else c(90, 0),
           text.col, text.alpha, text.cex, text.font,
           text.fontfamily, text.fontface, text.lineheight,
           line.col, line.lty, line.lwd, line.alpha)

current.panel.limits(unit = "native")



A character string indicating which side axes are to be drawn on. Partial specification is allowed.


Numeric vector giving location of labels. Can be missing, in which case they are computed from the native coordinates of the active viewport.


The labels to go along with at, as a character vector or a vector of expressions. This only makes sense provided at is explicitly specified, as otherwise the provided labels may not match the computed at values. Alternatively, labels can be a logical flag: If TRUE, the labels are derived from at, otherwise, labels are empty.


A logical indicating whether labels are to be drawn.


A logical, whether to check for overlapping of labels. This also has the effect of removing at values that are ‘too close’ to the limits.


A logical flag, indicating whether to draw the labels outside the panel or inside. Note that outside=TRUE will only have a visible effect if clipping is disabled for the viewport (panel).


Logical flag, whether to draw the tickmarks.


Logical flag, indicating whether only around half the scales will be drawn for each side. This is primarily used for axis labeling in splom.


Character string, either "lower" or "upper", indicating which half is to be used for tick locations if half = TRUE. Defaults to whichever is suitable for splom.


A numeric scalar multiplier for tick length. Can be negative, in which case the ticks point inwards.


Rotation angle(s) for labels in degrees. Can be a vector of length 2 for x- and y-axes.


Color for the axis label text. See gpar for more details on this and the other graphical parameters listed below.


Alpha-transparency value for the axis label text.


Size multiplier for the axis label text.

text.font, text.fontfamily, text.fontface

Font for the axis label text.


Line height for the axis label text.


Color for the axis label text.


Color for the axis.


Color for the axis.


Alpha-transparency value for the axis.


Which grid unit the values should be in.


panel.axis can draw axis tick marks inside or outside a panel (more precisely, a grid viewport). It honours the (native) axis scales. Used in panel.pairs for splom, as well as for all the usual axis drawing by the print method for "trellis" objects. It can also be used to enhance plots ‘after the fact’ by adding axes.


current.panel.limits returns a list with components xlim and ylim, which are both numeric vectors of length 2, giving the scales of the current panel (viewport). The values correspond to the unit system specified by unit, by default "native".


Deepayan Sarkar

See Also

Lattice, xyplot, trellis.focus, unit

lattice documentation built on Oct. 1, 2023, 9:06 a.m.