stat_stars {ggpubr} | R Documentation |
Add Stars to a Scatter Plot
Description
Create a star plot by drawing segments from group centroid to each points.
Usage
stat_stars(
mapping = NULL,
data = NULL,
geom = "segment",
position = "identity",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
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, 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 |
See Also
Examples
# 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",
mean.point = TRUE, ellipse = TRUE)+
stat_stars(aes(color = cyl))