addLabel: Axis Labels

View source: R/addLabel.R

addLabelR Documentation

Axis Labels

Description

Adds text in the margin for specialized axis labels.

Usage

addLabel(label, x, side = "bottom", size = "Auto", distance = 0.2,
  justification = "center", orientation = "parallel",
  current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log =
  FALSE))

Arguments

label

the text or expression to add to the graph.

x

the axis location in the correct user units.

side

the side to place label. Must be "bottom," "left," "top," or "right." Only the first letter is necessary.

size

the size of the text in points.

distance

the distance from the axis, in lines of text.

justification

defines the placement of the text relative to x if orientation is "parallel" and relative to distance if orientation is "perpendicular." Must be one of "left," "center," or "right."

orientation

the orientation of the label relative to the axis. Must be either "parallel" or "perpendicular."

current

the current plot parameters. Typically, this would be the output from one of the graph creation functions like xyPlot.

Value

Nothing is returned.

Note

In general, all functions that create plots will draw the necessary axes. This function should be used only to add axis labels to an unlabeled axis. Axis labels can be suppressed by setting up the margins with negative values or, for some functions, special arguments to xlabels or ylabels.

See Also

addAxisLabels, mtext and plotmath for example expressions,

Examples

## Not run: 
set.seed(1)
X <- as.POSIXct(c("2010-12-22 10:30", "2010-12-28 13:45", 
"2011-01-05 9:30", "2011-01-07 14:50"))
Y <- runif(4)
setGD()
AA.pl <- timePlot(X, Y, Plot=list(what="points"))
# Insert verical bar between years
addLabel("|", as.Date("2011-01-01"), distance=1.2)
# For more details of addLabel see
vignette(topic="GraphGallery", package="smwrGraphs")
demo(topic="AnnualFlowBarChart", package="smwrGraphs")

## End(Not run)

USGS-R/smwrGraphs documentation built on Oct. 11, 2022, 6:11 a.m.