if (!require("ggplot2")) install.packages("ggplot2")
## Loading required package: ggplot2
library(ggplot2)
# Membaca data CSV dengan pemisah titik koma (;)
data2 <- read.csv("DATASET 2 REGNON TUGAS 3.csv", sep = ";")
head(data2)
##      X1    X2    X3   X4    X5   X6     Y
## 1 12.10 34.05  8.50 2.22 64.81 40.2 73.84
## 2 12.45 44.19 10.13 2.20 68.65 32.9 76.87
## 3 13.39 38.66  8.99 1.68 69.07 29.7 77.19
## 4 14.38 26.30 10.04 2.16 69.18 23.6 69.08
## 5 17.86 23.36 10.27 1.46 68.34 33.4 78.27
## 6 13.38 10.06 10.87 1.38 70.14 30.1 84.72
ggplot(data2, aes(x = X1, y = Y)) +
  geom_point(color = "#2b5c8f", size = 2.5, alpha = 0.7) +
  geom_smooth(method = "lm", color = "#e67e22", se = TRUE) +
  labs(
    title = "Scatter Plot Variabel X1 vs Y (Dataset 2)",
    x = "Variabel X1",
    y = "Variabel Y"
  ) +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(data2, aes(x = X2, y = Y)) +
  geom_point(color = "#27ae60", size = 2.5, alpha = 0.7) +
  geom_smooth(method = "lm", color = "#e67e22", se = TRUE) +
  labs(
    title = "Scatter Plot Variabel X2 vs Y (Dataset 2)",
    x = "Variabel X2",
    y = "Variabel Y"
  ) +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(data2, aes(x = X3, y = Y)) +
  geom_point(color = "#8e44ad", size = 2.5, alpha = 0.7) +
  geom_smooth(method = "lm", color = "#e67e22", se = TRUE) +
  labs(
    title = "Scatter Plot Variabel X3 vs Y (Dataset 2)",
    x = "Variabel X3",
    y = "Variabel Y"
  ) +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(data2, aes(x = X4, y = Y)) +
  geom_point(color = "#d35400", size = 2.5, alpha = 0.7) +
  geom_smooth(method = "lm", color = "#e67e22", se = TRUE) +
  labs(
    title = "Scatter Plot Variabel X4 vs Y (Dataset 2)",
    x = "Variabel X4",
    y = "Variabel Y"
  ) +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(data2, aes(x = X5, y = Y)) +
  geom_point(color = "#16a085", size = 2.5, alpha = 0.7) +
  geom_smooth(method = "lm", color = "#e67e22", se = TRUE) +
  labs(
    title = "Scatter Plot Variabel X5 vs Y (Dataset 2)",
    x = "Variabel X5",
    y = "Variabel Y"
  ) +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(data2, aes(x = X6, y = Y)) +
  geom_point(color = "#c0392b", size = 2.5, alpha = 0.7) +
  geom_smooth(method = "lm", color = "#e67e22", se = TRUE) +
  labs(
    title = "Scatter Plot Variabel X6 vs Y (Dataset 2)",
    x = "Variabel X6",
    y = "Variabel Y"
  ) +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'