Controls the axis title, limits, tick positions, tick labels, the padding around the data, and the axis transform.
scale_x_continuous(
name = NULL,
limits = NULL,
breaks = NULL,
labels = NULL,
expand = 0.05,
trans = "identity"
)
scale_y_continuous(
name = NULL,
limits = NULL,
breaks = NULL,
labels = NULL,
expand = 0.05,
trans = "identity"
)Axis title (defaults to the mapped expression).
Optional numeric length-2 domain; NULL trains from data.
Explicit tick positions in data units, or NULL for
automatic "nice number" breaks.
Tick labels: a character vector the same length as
breaks, a function applied to the break values (e.g.
function(x) paste0("$", x)), or NULL for automatic formatting.
Fraction of the data span to pad onto each end of the axis
(default 5%). Use 0 for a tight axis.
Axis transform: "identity", "log10", "sqrt", or
"reverse".
A ScaleContinuous object to add with +.
ggnext(cars, aes(speed, dist)) +
geom_point() +
scale_x_continuous(
name = "Speed (mph)",
breaks = c(5, 10, 15, 20, 25),
expand = 0
) +
scale_y_continuous(labels = function(v) paste0(v, " ft"))
#> <ggnext plot>
#> data: 50 x 2
#> aes: x = speed, y = dist
#> layers: 1
#> coord: cartesian
#> mode: static