date_axis | R Documentation |
Special axis for date handling, including interval labelling.
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,
...)
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 |
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".
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.