Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

scale

Coordinates and Positions for Chronological Objects


Description

chron_trans is a ggplot2 transformer for chron. scale_x_chron and scale_y_chron are ggplot2 scales.

Usage

chron_trans(format = "%Y-%m-%d", n = 5)
  scale_x_chron(..., format = "%Y-%m-%d", n = 5)
  scale_y_chron(..., format = "%Y-%m-%d", n = 5)

Arguments

format

format string as described in strptime.

n

Approximate number of axis ticks.

...

Passed to scale_x_continuous.

Examples

if(require("ggplot2")) {
    dd <- data.frame(tt = chron(1:10), value = 101:110)
    p <- ggplot(dd, aes(tt, value)) +
             geom_point() + scale_x_chron(format = "%m-%d")
    print(p)
}

chron

Chronological Objects which can Handle Dates and Times

v2.3-56
GPL-2
Authors
David James [aut] (S original), Kurt Hornik [aut, trl, cre] (<https://orcid.org/0000-0003-4198-9911>), Gabor Grothendieck [ctb], R Core Team [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.