| breaks_timespan | R Documentation |
Pretty time span breaks for plotting in units of 5, 15, 30, 60 sec, etc.
Modified from scales::breaks_timespan().
breaks_timespan(unit = c("secs", "mins", "hours", "days", "weeks"), n = 5)
unit |
The time unit used to interpret numeric data input (defaults to "secs"). |
n |
Desired number of breaks. You may get slightly more or fewer breaks than requested. |
Returns a function for generating breaks.
x <- 0:120
y <- sin(2 * pi * x / 15) + rnorm(length(x), 0, 0.2)
ggplot2::ggplot(data.frame(x, y), ggplot2::aes(x, y)) +
theme_mnirs() +
ggplot2::scale_x_continuous(breaks = breaks_timespan()) +
ggplot2::geom_line()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.