date_axis: gsplot date axis

View source: R/date_axis.R

date_axisR Documentation

gsplot date axis

Description

Special axis for date handling, including interval labelling.

Usage

date_axis(object, ...)

date_axis.gsplot(object, ..., side, pos.lab = "tick", at = NULL,
  tick.int = NULL, snap.to = "day", warn = TRUE)

date_axis.default(side, pos.lab = "tick", tick.int = NULL, snap.to = NULL,
  ...)

Arguments

object

gsplot object

...

Further graphical parameters may also be supplied as arguments. See 'Details'.

side

side to place the axis on

pos.lab

where should the label be positioned, centered on the "tick" or "interval".

at

specific location to place ticks

tick.int

interval in which ticks should be placed, alternative to defining at.

snap.to

set the limits to coincide with temporal boundaries. Accepts "day", "week", "month", "quarter", "year", "wateryear", "decade".

warn

set to FALSE to turn off experimental warning

Details

Additional graphical parameter inputs:

  • pos.lab where should the label be positioned, centered on the "tick" or "interval".

  • tick.int interval in which ticks should be placed, alternative to defining at.

  • snap.to set the limits to coincide with temporal boundaries. Accepts "day", "week", "month", "quarter", "year", "wateryear", "decade".

Examples

x <- seq(as.Date("2013-01-22"), as.Date("2013-10-02"), "days")
y <- rnorm(length(x), 71, 19)
gs <- gsplot() %>%
   points(x, y) %>%
   date_axis(side=1, pos.lab="interval", tick.int="month", snap.to="year")
gs

x <- seq(as.POSIXct("1992-03-03 06:00:00"), as.POSIXct("1992-03-08 12:00:00"), "hour")
y <- rnorm(length(x), 19, 2)
gs <- gsplot() %>%
   points(x, y) %>%
   date_axis(side=1, pos.lab="tick", tick.int="day", snap.to="day", format="%D")
gs

USGS-R/gsplot documentation built on April 17, 2023, 8:45 p.m.