View source: R/xgx_scale_x_time_units.R
xgx_scale_x_time_units | R Documentation |
xgx_scale_x_time_units
converts x axis scale from one time unit
to another.
Supported units include hours, days, weeks, months, and years, which
can also be called using just the first letter (h, d, w, m, y).
xgx_scale_x_time_units(
units_dataset,
units_plot = NULL,
breaks = NULL,
labels = NULL,
...
)
xgx_scale_y_time_units(
units_dataset,
units_plot = NULL,
breaks = NULL,
labels = NULL,
...
)
units_dataset |
units of the input dataset, must be specified by user as "h", "d", "w", "m", or "y" |
units_plot |
units of the plot, will be units of the dataset if empty |
breaks |
One of:
|
labels |
One of:
|
... |
other parameters for
|
Note: xgx_scale_x_time_units
only scales the plot axis, all other
specifications must be on the original scale of the dataset (e.g. breaks,
position, width)
ggplot2 compatible scale object
data <- data.frame(x = 1:1000, y = rnorm(1000))
ggplot2::ggplot(data = data, ggplot2::aes(x = x, y = y)) +
ggplot2::geom_point() +
xgx_scale_x_time_units(units_dataset = "hours", units_plot = "weeks")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.