geom_jitter transparency
# Load necessary libraries
library(ggplot2)
# Create a sample data frame
set.seed(123)
data <- data.frame(
x = rep(c("A", "B", "C"), each = 30),
y = rnorm(90),
group = rep(c("Group 1", "Group 2"), each = 45)
)
# Create a jittered scatter plot with transparency
ggplot(data, aes(x = x, y = y, color = group)) +
geom_jitter(width = 0.2, height = 0, alpha = 0.7) +
scale_color_manual(values = c("Group 1" = "red", "Group 2" = "blue")) +
theme_minimal()