View source: R/scale_cases_5er.R
scale_y_cases_5er | R Documentation |
A continuous ggplot scale for count data with sane defaults for breaks.
It uses base::pretty()
to increase the default number of breaks and prefers 5er breaks.
Additionally, the first tick (i.e. zero) is aligned to the lower left corner.
scale_y_cases_5er(
name = waiver(),
n = 8,
min.n = 5,
u5.bias = 4,
expand = NULL,
labels = waiver(),
limits = NULL,
oob = scales::censor,
na.value = NA_real_,
transform = "identity",
position = "left",
sec.axis = waiver(),
guide = waiver(),
...
)
scale_x_cases_5er(
name = waiver(),
n = 8,
min.n = 5,
u5.bias = 4,
expand = NULL,
labels = waiver(),
limits = NULL,
oob = scales::censor,
na.value = NA_real_,
transform = "identity",
position = "bottom",
sec.axis = waiver(),
guide = waiver(),
...
)
name |
The name of the scale. Used as the axis or legend title. If
|
n |
Target number of breaks passed to |
min.n |
Minimum number of breaks passed to |
u5.bias |
The "5-bias" parameter passed to |
expand |
Uses own expansion logic. Use |
labels |
One of:
|
limits |
One of:
|
oob |
One of:
|
na.value |
Missing values will be replaced with this value. |
transform |
For continuous scales, the name of a transformation object or the object itself. Built-in transformations include "asn", "atanh", "boxcox", "date", "exp", "hms", "identity", "log", "log10", "log1p", "log2", "logit", "modulus", "probability", "probit", "pseudo_log", "reciprocal", "reverse", "sqrt" and "time". A transformation object bundles together a transform, its inverse,
and methods for generating breaks and labels. Transformation objects
are defined in the scales package, and are called |
position |
For position scales, The position of the axis.
|
sec.axis |
|
guide |
A function used to create a guide or its name. See
|
... |
Additional arguments passed on to |
A ggplot2
scale object that can be added to a plot.
geom_epicurve()
, ggplot2::scale_y_continuous()
, base::pretty()
,
theme_mod_remove_minor_grid_y()
library(ggplot2)
data <- data.frame(date = as.Date("2024-01-01") + 0:30)
ggplot(data, aes(x = date)) +
geom_epicurve(date_resolution = "week") +
scale_y_cases_5er() +
theme_mod_remove_minor_grid_y()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.