stat_mean | R Documentation |
Draw the mean point of each group.
stat_mean( mapping = NULL, data = NULL, geom = "point", position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ... )
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, either as a
|
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
na.rm |
If FALSE (the default), removes missing values with a warning. If TRUE silently removes missing values. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
... |
other arguments to pass to |
stat_conf_ellipse
, stat_chull
and
ggscatter
# Load data data("mtcars") df <- mtcars df$cyl <- as.factor(df$cyl) # Scatter plot with ellipses and group mean points ggscatter(df, x = "wt", y = "mpg", color = "cyl", shape = "cyl", ellipse = TRUE)+ stat_mean(aes(color = cyl, shape = cyl), size = 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.