# Memanggil library ggplot2 
library(ggplot2) 

# Membaca Dataset 2 
dataset2 <- read.csv( "DATA SET 2 REGNON.csv", sep = ";", dec = "," )

# Menampilkan beberapa data pertama 
head(dataset2)
##      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
#Scatter plot x1 dan Y
ggplot(dataset2, aes(x = X1, y = Y)) + geom_point( color = "steelblue", 
      size = 2.5, alpha = 0.7 ) + geom_smooth( method = "lm", 
      se = FALSE, color = "red", 
      linewidth = 1 ) + labs( title = "Scatter Plot X1 dan Y", 
      x = "X1", y = "Y" ) + theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

#Scatter plot x2 dan Y
ggplot(dataset2, aes(x = X2, y = Y)) + geom_point( color = "darkorange", 
      size = 2.5, alpha = 0.7 ) + geom_smooth( method = "lm", 
      se = FALSE, color = "blue", 
      linewidth = 1 ) + labs( title = "Scatter Plot X2 dan Y", 
      x = "X2", y = "Y" ) + theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

#Scatter plot x3 dan Y
ggplot(dataset2, aes(x = X3, y = Y)) + geom_point( color = "purple", 
      size = 2.5, alpha = 0.7 ) + geom_smooth( method = "lm", 
      se = FALSE, color = "black", 
      linewidth = 1 ) + labs( title = "Scatter Plot X3 dan Y", 
      x = "X3", y = "Y" ) + theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

#Scatter plot x4 dan Y
ggplot(dataset2, aes(x = X4, y = Y)) + geom_point( color = "forestgreen", 
      size = 2.5, alpha = 0.7 ) + geom_smooth( method = "lm", 
      se = FALSE, color = "red", 
      linewidth = 1 ) + labs( title = "Scatter Plot X4 dan Y", 
      x = "X4", y = "Y" ) + theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

#Scatter plot X5 dan Y
ggplot(dataset2, aes(x = X5, y = Y)) + geom_point( color = "brown", 
      size = 2.5, alpha = 0.7 ) + geom_smooth( method = "lm", 
      se = FALSE, color = "blue", 
      linewidth = 1 ) + labs( title = "Scatter Plot X5 dan Y", 
      x = "X5", y = "Y" ) + theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

#Scatter plot X6 DAN Y
ggplot(dataset2, aes(x = X6, y = Y)) + geom_point( color = "deeppink", 
      size = 2.5, alpha = 0.7 ) + geom_smooth( method = "lm", 
      se = FALSE, color = "black", 
      linewidth = 1 ) + labs( title = "Scatter Plot X6 dan Y", 
      x = "X6", y = "Y" ) + theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'