library(readxl)
library(ggpubr)
## Loading required package: ggplot2
Replace Full Path with required path
D1 <- D1 <- read_excel("A4Q1.xlsx")
Plot the graph
ggscatter(
D1,
x = "age",
y = "education",
color = "#00A",
shape = "triangle",
add = "reg.line",
add.params = list(color = "red", size = 2), # Change ONLY the line color here
xlab = "Independent Variable (age) /years",
ylab = "Dependent Variable (education) /years"
)
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## ℹ The deprecated feature was likely used in the ggpubr package.
## Please report the issue at <https://github.com/kassambara/ggpubr/issues>.
## This warning is displayed once per session.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.