geom_quantile(mapping = NULL, data = NULL, stat = "quantile", position = "identity", lineend = "butt", linejoin = "round", linemitre = 1, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...)stat_quantile(mapping = NULL, data = NULL, geom = "quantile", position = "identity", quantiles = c(0.25, 0.5, 0.75), formula = NULL, method = "rq", method.args = list(), na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...)
aes
or
aes_
. If specified and inherit.aes = TRUE
(the
default), is combined with the default mapping at the top level of the
plot. You only need to supply mapping
if there isn't a mapping
defined for the plot.FALSE
(the default), removes missing values with
a warning. If TRUE
silently removes missing values.NA
, the default, includes if any aesthetics are mapped.
FALSE
never includes, and TRUE
always includes.FALSE
, overrides the default aesthetics,
rather than combining with them. This is most useful for helper functions
that define both data and aesthetics and shouldn't inherit behaviour from
the default plot specification, e.g. borders
.layer
. There are
three types of arguments you can use here:
color = "red"
or size = 3
.
stat
associated with the layer.
geom_quantile
and stat_quantile
.rq
.method
.This can be used as a continuous analogue of a geom_boxplot.
geom_quantile
understands the following aesthetics (required aesthetics are in bold):
x
y
alpha
colour
linetype
size
weight
m <- ggplot(mpg, aes(displ, 1 / hwy)) + geom_point() m + geom_quantile()Smoothing formula not specified. Using: y ~ x
m + geom_quantile(quantiles = 0.5)Smoothing formula not specified. Using: y ~ x
q10 <- seq(0.05, 0.95, by = 0.05) m + geom_quantile(quantiles = q10)Smoothing formula not specified. Using: y ~ x
# You can also use rqss to fit smooth quantiles m + geom_quantile(method = "rqss")Smoothing formula not specified. Using: y ~ qss(x, lambda = 1)
# Note that rqss doesn't pick a smoothing constant automatically, so # you'll need to tweak lambda yourself m + geom_quantile(method = "rqss", lambda = 0.1)Smoothing formula not specified. Using: y ~ qss(x, lambda = 0.1)
# Set aesthetics to fixed value m + geom_quantile(colour = "red", size = 2, alpha = 0.5)Smoothing formula not specified. Using: y ~ x