stat_center {gggda} | R Documentation |
Centers and spreads for bivariate data
Description
Centers and spreads for bivariate data
Usage
stat_center(
mapping = NULL,
data = NULL,
geom = "point",
position = "identity",
show.legend = NA,
inherit.aes = TRUE,
...,
fun.data = NULL,
fun = NULL,
fun.center = NULL,
fun.min = NULL,
fun.max = NULL,
fun.ord = NULL,
fun.args = list()
)
stat_star(
mapping = NULL,
data = NULL,
geom = "segment",
position = "identity",
show.legend = NA,
inherit.aes = TRUE,
...,
fun.data = NULL,
fun = NULL,
fun.center = NULL,
fun.ord = NULL,
fun.args = list()
)
Arguments
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
geom |
The geometric object to use to display the data for this layer.
When using a
|
position |
A position adjustment to use on the data for this layer. This
can be used in various ways, including to prevent overplotting and
improving the display. The
|
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
... |
Additional arguments passed to |
fun.data |
A function that is given the complete data and should
return a data frame with variables |
fun.center |
Deprecated alias to |
fun.min , fun , fun.max |
Alternatively, supply three individual functions that are each passed a vector of values and should return a single number. |
fun.ord |
Alternatively to the |
fun.args |
Optional additional arguments passed on to the functions. |
Value
Multidimensional position aesthetics
This statistical transformation is compatible with the convenience function
aes_coord()
.
Some transformations (e.g. stat_center()
) commute with projection to the
lower (1 or 2)-dimensional biplot space. If they detect aesthetics of the
form ..coord[0-9]+
, then ..coord1
and ..coord2
are converted to x
and
y
while any remaining are ignored.
Other transformations (e.g. stat_spantree()
) yield different results in a
lower-dimensional biplot when they are computed before versus after
projection. If the stat layer detects these aesthetics, then the
transformation is performed before projection, and the results in the first
two dimensions are returned as x
and y
.
A small number of transformations (stat_rule()
) are incompatible with
these aesthetics but will accept aes_coord()
without warning.
Computed variables
These are calculated during the statistical transformation and can be accessed with delayed evaluation.
xmin,ymin,xmax,ymax
results of
fun.min,fun.max
applied tox,y
See Also
Other stat layers:
stat_bagplot()
,
stat_chull()
,
stat_cone()
,
stat_depth()
,
stat_rule()
,
stat_scale()
,
stat_spantree()
Examples
ggplot(mpg, aes(x = displ, y = cty, shape = drv)) +
geom_point() +
stat_center(fun = "median", size = 5, alpha = .5)
ggplot(mpg, aes(x = displ, y = cty, shape = drv, linetype = drv)) +
stat_center(size = 3) +
stat_star()