library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.5.3
# Membaca data dari file teks
data_obesitas <- read.delim("C:/Users/blaar/Downloads/ObesityDataSet_raw_and_data_sinthetic_new.txt", sep = "\t", header = TRUE)
# Membuat Scatter Plot: X = Height (Tinggi), Y = Weight (Berat) dengan 1 garis tren
ggplot(data_obesitas, aes(x = Height, y = Weight)) +
geom_point(aes(color = Gender), size = 2.5, alpha = 0.7) +
geom_smooth(method = "lm", color = "black", se = FALSE) + # 1 garis tren untuk seluruh data
labs(
title = "Scatter Plot Tinggi Badan vs Berat Badan",
x = "Tinggi Badan (Height)",
y = "Berat Badan (Weight)"
) +
theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'
library(ggplot2)
# Membaca data dari file teks
data_obesitas <- read.delim("C:/Users/blaar/Downloads/ObesityDataSet_raw_and_data_sinthetic_new.txt", sep = "\t", header = TRUE)
# Membuat Scatter Plot: X = Age (Umur), Y = Weight (Berat) dengan 1 garis tren
ggplot(data_obesitas, aes(x = Age, y = Weight)) +
geom_point(aes(color = Gender), size = 2.5, alpha = 0.7) +
geom_smooth(method = "lm", color = "black", se = FALSE) + # 1 garis tren untuk seluruh data
labs(
title = "Scatter Plot Umur vs Berat Badan",
x = "Umur (Age)",
y = "Berat Badan (Weight)"
) +
theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'
library(ggplot2)
# Membaca data dari file teks
data_obesitas <- read.delim("C:/Users/blaar/Downloads/ObesityDataSet_raw_and_data_sinthetic_new.txt", sep = "\t", header = TRUE)
# Membuat Scatter Plot: X = Age (Umur), Y = Height (Tinggi) dengan 1 garis tren
ggplot(data_obesitas, aes(x = Age, y = Height)) +
geom_point(aes(color = Gender), size = 2.5, alpha = 0.7) +
geom_smooth(method = "lm", color = "black", se = FALSE) + # 1 garis tren untuk seluruh data
labs(
title = "Scatter Plot Umur vs Tinggi Badan",
x = "Umur (Age)",
y = "Tinggi Badan (Height)"
) +
theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'
```