library(ggplot2)
# Input Data
data <- data.frame(
Y = c(57.5, 52.8, 61.3, 67.0, 53.5, 62.7, 56.2, 68.5, 69.2),
X1 = c(78, 69, 77, 88, 67, 80, 74, 94, 102),
X2 = c(2.75, 2.15, 4.41, 5.52, 3.21, 4.32, 2.31, 4.30, 3.71),
X3 = c(29.5, 26.3, 32.2, 36.5, 27.2, 27.7, 28.3, 30.3, 28.7)
)
# 1. Scatter Plot X1 vs Y
ggplot(data, aes(x = X1, y = Y)) +
geom_point(color = "#1E88E5", size = 2.5, alpha = 0.8) +
geom_smooth(method = "lm", se = FALSE, color = "#90CAF9", linetype = "dashed", linewidth = 1.2) +
labs(title = "Scatter Plot X1 vs Y", x = "X1", y = "Y") +
theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

# 2. Scatter Plot X2 vs Y
ggplot(data, aes(x = X2, y = Y)) +
geom_point(color = "#2E7D32", size = 2.5, alpha = 0.8) +
geom_smooth(method = "lm", se = FALSE, color = "#81C784", linetype = "dashed", linewidth = 1.2) +
labs(title = "Scatter Plot X2 vs Y", x = "X2", y = "Y") +
theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

# 3. Scatter Plot X3 vs Y
ggplot(data, aes(x = X3, y = Y)) +
geom_point(color = "#7B1FA2", size = 2.5, alpha = 0.8) +
geom_smooth(method = "lm", se = FALSE, color = "#CE93D8", linetype = "dashed", linewidth = 1.2) +
labs(title = "Scatter Plot X3 vs Y", x = "X3", y = "Y") +
theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'
