data <- read.table(file.choose(), header = TRUE, sep = "\t")
data
##      Y  X1   X2   X3
## 1 57.5  78 2.75 29.5
## 2 52.8  69 2.15 26.3
## 3 61.3  77 4.41 32.2
## 4 67.0  88 5.52 36.5
## 5 53.5  67 3.21 27.2
## 6 62.7  80 4.32 27.7
## 7 56.2  74 2.31 28.3
## 8 68.5  94 4.30 30.3
## 9 69.2 102 3.71 28.7
library(ggplot2)

# a. Scatter Plot X1 dan Y
ggplot(data, aes(x = X1, y = Y)) +
  geom_point(color = "#E91E63", size = 3, alpha = 0.8) +
  geom_smooth(
    method = "lm",
    se = FALSE,
    color = "#4A148C",
    linewidth = 1,
    linetype = "dashed"
  ) +
  labs(
    title = "Scatter Plot X1 dan Y",
    x = "X1",
    y = "Y"
  ) +
  scale_x_continuous(breaks = seq(65, 105, 2)) +
  scale_y_continuous(breaks = seq(52, 72, 1)) +
  theme_minimal() +
  theme(
    plot.title = element_text(hjust = 0.5, face = "bold", size = 14)
  )
## `geom_smooth()` using formula = 'y ~ x'

# b. Scatter Plot X2 dan Y
ggplot(data, aes(x = X2, y = Y)) +
  geom_point(color = "#2E8B57", size = 3, alpha = 0.8) +
  geom_smooth(
    method = "lm",
    se = FALSE,
    color = "#E65100",
    linewidth = 1,
    linetype = "dashed"
  ) +
  labs(
    title = "Scatter Plot X2 dan Y",
    x = "X2",
    y = "Y"
  ) +
  scale_x_continuous(breaks = seq(2, 6, 0.5)) +
  scale_y_continuous(breaks = seq(52, 72, 1)) +
  theme_minimal() +
  theme(
    plot.title = element_text(hjust = 0.5, face = "bold", size = 14)
  )
## `geom_smooth()` using formula = 'y ~ x'

# c. Scatter Plot X3 dan Y
ggplot(data, aes(x = X3, y = Y)) +
  geom_point(color = "#F9A825", size = 3, alpha = 0.8) +
  geom_smooth(
    method = "lm",
    se = FALSE,
    color = "#C2185B",
    linewidth = 1,
    linetype = "dashed"
  ) +
  labs(
    title = "Scatter Plot X3 dan Y",
    x = "X3",
    y = "Y"
  ) +
  scale_x_continuous(breaks = seq(25, 40, 1)) +
  scale_y_continuous(breaks = seq(52, 72, 1)) +
  theme_minimal() +
  theme(
    plot.title = element_text(hjust = 0.5, face = "bold", size = 14)
  )
## `geom_smooth()` using formula = 'y ~ x'

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.