##create x axis
x <- seq(-10, 10, length.out = 1000)
##create a data frame that illustrates SD change in normal curve
df <- data.frame(x = rep(x, 3),
y = c(dnorm(x, mean = 0, sd = 1),
dnorm(x, mean = 0, sd = 2),
dnorm(x, mean = 0, sd = 3)),
Distribution = rep(c("SD = 1 (Low Variance)",
"SD = 2 (Medium Variance)",
"SD = 3 (High Variance)"),
each = length(x)))
##plot each curve with ggplot
ggplot(df, aes(x = x, y = y, color = Distribution)) +
geom_line(size = 1.2) +
labs(title = "Normal Curves with Different Standard Deviations",
x = "Value",
y = "Probability Density") +
scale_color_manual(values = c("mediumaquamarine", "thistle3", "palevioletred")) +
theme_minimal(base_size = 14) +
theme(plot.title = element_text(hjust = 0.5, face = "bold"),
legend.position = "bottom")
