library(ggplot2)
data_paru <- read.csv("C:/Users/hp/Downloads/LungCapData (1).csv")
str(data_paru)
## 'data.frame':    725 obs. of  6 variables:
##  $ LungCap  : num  6.47 10.12 9.55 11.12 4.8 ...
##  $ Age      : int  6 18 16 14 5 11 8 11 15 11 ...
##  $ Height   : num  62.1 74.7 69.7 71 56.9 58.7 63.3 70.4 70.5 59.2 ...
##  $ Smoke    : chr  "no" "yes" "no" "no" ...
##  $ Gender   : chr  "male" "female" "female" "male" ...
##  $ Caesarean: chr  "no" "no" "yes" "no" ...
ggplot(data_paru, aes(x = LungCap, y = Height, color = Gender, size = Age)) +
geom_point(alpha = 0.7) +
labs(title = "Hubungan Kapasitas Paru dan Tinggi Badan",
x = "LungCap",
y = "Height") +
theme_minimal()

ggplot(data_paru, aes(x = LungCap, y = Height, color = Gender, size = Age)) +
  geom_point(alpha = 0.7) +   # titik dengan transparansi
  labs(
    title = "Hubungan Kapasitas Paru dan Tinggi Badan",
    subtitle = "Scatter plot menunjukkan perbedaan berdasarkan Gender dan ukuran
                              titik menunjukkan usia (Age)",
    caption = "Sumber: Data Paru-Paru (Tugas 3)",
    x = "LungCap (Kapasitas Paru)",
    y = "Height (Tinggi Badan)",
    color = "Gender",
    size = "Usia (Age)"
  ) +
  theme_classic() +  # tema kustom
  theme(
    plot.title = element_text(size = 16, face = "bold", hjust = 1),
    plot.subtitle = element_text(size = 12, face = "italic", hjust = 0),
    plot.caption = element_text(size = 10, hjust = 0, margin = margin(t = 12)),
    axis.title = element_text(size = 12),
    axis.text = element_text(size = 10),
    legend.title = element_text(size = 12),
    legend.text = element_text(size = 10)
  )