Skip to contents

Custom wrapper for geom_density

Usage

geom_density_RR(..., alpha = 0.5)

Arguments

...

Other arguments passed on to layer(). These are often aesthetics, used to set an aesthetic to a fixed value, like colour = "red" or size = 3. They may also be parameters to the paired geom/stat.

alpha

Degree of transparency in the density plots.

Examples

library(ggplot2)
# Generate example data
set.seed(123)
data <- data.frame(
  Group = rep(c("Group1", "Group2"), each = 200),
  Value = c(rnorm(200, mean = 0, sd = 1), rnorm(200, mean = 2, sd = 1)))

# Create density plot
data |>
  ggplot(aes(x = Value, fill = Group)) +
  theme_RR() +
  geom_density_RR(alpha = 0.5) +
  labs(x = "Value", y = "Density",
       fill = "Group") +
  scale_fill_RR()