axesLabels {plotfunctions}R Documentation

Format axes labels.

Description

Format axes labels. Wrapper around format and axis.

Usage

axesLabels(
  xmark = TRUE,
  ymark = TRUE,
  replace = NULL,
  trim = TRUE,
  big.mark = "",
  decimal.mark = ".",
  ...
)

Arguments

xmark

Logical: If set to TRUE (default), only the extreme values of the x-axis are returned (pretty tickmark locations). Alternatively, if xmark is specified as numeric vector (length larger than 1), the provided numeric values are polished and returned; if a two-element list is provided, the second element should provide the labels for the locations in the first element. See examples.

ymark

Logical: If set to TRUE (default), only the extreme values of the y-axis are returned (pretty tickmark locations). Alternatively, if ymark is specified as numeric vector (length larger than 1), the provided numeric values are polished and returned; if a two-element list is provided, the second element should provide the labels for the locations in the first element. See examples.

replace

Two-element list: The first element contains a vector with patterns to be replaced using the function gsub, and the second element contains a vector with the replacements.

trim

Logical: Argument to format. If FALSE, logical, numeric and complex values are right-justified to a common width, if TRUE (default) the leading blanks for justification are suppressed.

big.mark

character: Argument to format, thousands separator. By default empty string (no separation).

decimal.mark

character: Argument to format, decimal symbol. By default ".".

...

Other parameters provided to format.

Value

List with x-positions and associated string labels, and y-positions and associated string labels.

Examples

# default axes:
emptyPlot(-56, 1006)
# simplified axes:
emptyPlot(-56, 1006,
    xmark=TRUE, ymark=TRUE, las=1)
# correction of minus symbol and thousand separator:
# (results in LaTeX errors when creating PDF version of help files)
## Not run: 
emptyPlot(-56, 1006, axes=FALSE)
labs = axesLabels(big.mark=" ",
                  replace=list(old=c("-"),new=c("\U2212")) )
axis(1, at=labs$xat, labels=labs$xlab, las=1)
axis(2, at=labs$yat, labels=labs$ylab, las=1)

## End(Not run)
# custom axes labels:
labs2 = axesLabels(xmark=list(c(-56,-28,0), c("start", "center", "end")) )
axis(1, at=labs2$xat, labels=labs2$xlab, las=1,
    col.axis=alpha(2), col=alpha(2), lwd=2,
    line=-3)
# using other arguments for format:
labs3 = axesLabels(replace=NULL, trim=FALSE, scientific=TRUE)
axis(1, at=labs3$xat, labels=labs3$xlab, las=1,
    line=-6)


[Package plotfunctions version 1.5 Index]