Visualisasi Data Kategorik & Numerik – Tingkat Pengangguran Terbuka Indonesia

Mata kuliah: Eksplorasi Dan Visualisasi Data

Kelas: A

Anggota Kelompok

  1. NAUFAL ARRAFI UDIANSYAH (3338240041)
  2. HEGGY SEPTIAN PRATAMA (3338240046)
  3. KOHAN AMINUDIN (3338240034)

Deskripsi Data & Sumber

Topik: Ekonomi – Tingkat Pengangguran Terbuka (TPT) per Provinsi di Indonesia.

Sumber data: Badan Pusat Statistik (BPS) – tabel TPT menurut provinsi (persen) tahun 2025 (Februari & Agustus).
Link: https://www.bps.go.id/id/statistics-table/2/NTQzIzI=/tingkat-pengangguran-terbuka.html

Review singkat (kenapa memilih data): - TPT adalah indikator penting untuk melihat kondisi pasar kerja. - Data tersedia per provinsi → cocok untuk visualisasi kategorik (wilayah) & numerik (distribusi). - Ada 2 periode (Februari dan Agustus) → bisa dibandingkan.

Input Data (Import & Pembersihan)

raw <- read_excel("Tingkat_Pengangguran.xlsx")

df <- raw %>%
  slice(3:n()) %>%
  setNames(c("Provinsi", "Feb_2025", "Aug_2025")) %>%
  mutate(
    Feb_2025 = as.numeric(Feb_2025),
    Aug_2025 = as.numeric(Aug_2025)
  ) %>%
  filter(!is.na(Provinsi))

glimpse(df)
## Rows: 39
## Columns: 3
## $ Provinsi <chr> "ACEH", "SUMATERA UTARA", "SUMATERA BARAT", "RIAU", "JAMBI", …
## $ Feb_2025 <dbl> 5.50, 5.05, 5.69, 4.12, 4.48, 3.89, 3.24, 4.07, 4.17, 6.89, 6…
## $ Aug_2025 <dbl> 5.64, 5.32, 5.62, 4.16, 4.26, 3.69, 3.41, 4.21, 4.45, 6.45, 6…
summary(df)
##    Provinsi            Feb_2025        Aug_2025    
##  Length:39          Min.   :1.580   Min.   :1.490  
##  Class :character   1st Qu.:3.370   1st Qu.:3.540  
##  Mode  :character   Median :4.210   Median :4.210  
##                     Mean   :4.438   Mean   :4.478  
##                     3rd Qu.:5.415   3rd Qu.:5.470  
##                     Max.   :6.920   Max.   :6.960

Buat versi long untuk plot per-periode. Urutan periode: Februari dulu, baru Agustus.

df_long <- df %>%
  pivot_longer(c(Feb_2025, Aug_2025),
               names_to = "Periode", values_to = "TPT") %>%
  mutate(
    Periode = recode(Periode,
                     Feb_2025 = "Februari 2025",
                     Aug_2025 = "Agustus 2025"),
    Periode = factor(Periode, levels = c("Februari 2025", "Agustus 2025"))
  )

A. Visualisasi Data Kategorik

A1. Bar chart (Top 10 TPT Februari 2025)

top10_feb <- df %>%
  arrange(desc(Feb_2025)) %>%
  slice_head(n = 10) %>%
  mutate(Provinsi = fct_reorder(Provinsi, Feb_2025))

ggplot(top10_feb, aes(Provinsi, Feb_2025, fill = Feb_2025)) +
  geom_col(show.legend = FALSE) +
  coord_flip() +
  scale_y_continuous(labels = label_number(suffix = "%")) +
  labs(title = "Top 10 Provinsi dengan TPT Tertinggi (Februari 2025)",
       x = NULL, y = "TPT")

Interpretasi:
Bar chart memperlihatkan 10 provinsi dengan TPT tertinggi pada Februari 2025. Provinsi dengan bar paling panjang memiliki tingkat pengangguran paling tinggi.

A2. Needle chart (Feb vs Agustus untuk 10 provinsi tertinggi Februari)

df_top10_long <- df_long %>%
  filter(Provinsi %in% top10_feb$Provinsi) %>%
  mutate(Provinsi = fct_reorder(Provinsi, TPT, .fun = max))

ggplot(df_top10_long, aes(Provinsi, TPT, color = TPT)) +
  geom_segment(aes(xend = Provinsi, y = 0, yend = TPT),
               linewidth = 1.05, alpha = 0.85) +
  geom_point(size = 2.7) +
  coord_flip() +
  facet_wrap(~Periode) +
  scale_y_continuous(labels = label_number(suffix = "%")) +
  labs(title = "Needle Chart TPT (Februari vs Agustus 2025) - 10 Provinsi Tertinggi (basis Februari)",
       x = NULL, y = "TPT") +
  theme(legend.position = "none")

Interpretasi:
Needle chart menegaskan besar-kecilnya TPT lewat “jarum” dari nol ke nilai TPT dan memudahkan membandingkan Februari vs Agustus untuk provinsi yang sama.

A3. Pie chart (proporsi provinsi menurut kategori TPT Februari)

df_feb_cat <- df %>%
  mutate(
    Kategori_TPT_Feb = cut(Feb_2025,
                           breaks = c(-Inf, 4, 5, 6, Inf),
                           labels = c("< 4%", "4–5%", "5–6%", "> 6%"))
  ) %>%
  count(Kategori_TPT_Feb) %>%
  mutate(prop = n / sum(n),
         label = paste0(Kategori_TPT_Feb, "\n", percent(prop, accuracy = 1)))

ggplot(df_feb_cat, aes("", prop, fill = Kategori_TPT_Feb)) +
  geom_col(width = 1, color = "grey20") +
  coord_polar(theta = "y") +
  geom_text(aes(label = label),
            position = position_stack(vjust = 0.5),
            size = 3.5, color = "white") +
  scale_y_continuous(labels = percent) +
  labs(title = "Proporsi Provinsi berdasarkan Kategori TPT (Februari 2025)",
       x = NULL, y = NULL, fill = "Kategori") +
  theme(axis.text = element_blank(), axis.ticks = element_blank())

Interpretasi:
Pie chart menunjukkan komposisi provinsi pada tiap kategori TPT Februari. Irisan terbesar = kategori yang paling banyak diisi provinsi.

A4. Peta spasial (choropleth TPT Agustus 2025)

library(sf)
library(geodata)
library(tmap)
tmap_mode("plot")

idn1 <- geodata::gadm(country = "IDN", level = 1, path = tempdir()) %>% st_as_sf()

df_join <- df %>% mutate(key = str_squish(tolower(Provinsi)))
idn1_join <- idn1 %>%
  mutate(key = str_squish(tolower(NAME_1))) %>%
  left_join(df_join, by = "key")

tm_shape(idn1_join) +
  tm_polygons(
    col = "Feb_2025",
    title = "TPT Februari 2025 (%)",
    palette = "-viridis",
    style = "jenks",
    n = 5,
    border.col = "grey30",
    lwd = 0.8,
    textNA = "Data tidak tersedia",
    colorNA = "grey20"
  ) +
  tm_layout(
    title = "Peta TPT per Provinsi (Februari 2025)",
    frame = FALSE,
    bg.color = "#0b0f14",
    title.color = "white",
    legend.bg.color = "#111827",
    legend.bg.alpha = 1,
    legend.text.color = "white",
    legend.title.color = "white"
  )

tm_shape(idn1_join) +
  tm_polygons(
    col = "Aug_2025",
    title = "TPT Agustus 2025 (%)",
    palette = "-viridis",
    style = "jenks",
    n = 5,
    border.col = "grey30",
    lwd = 0.8,
    textNA = "Data tidak tersedia",
    colorNA = "grey20"
  ) +
  tm_layout(
    title = "Peta TPT per Provinsi (Agustus 2025)",
    frame = FALSE,
    bg.color = "#0b0f14",
    title.color = "white",
    legend.bg.color = "#111827",
    legend.bg.alpha = 1,
    legend.text.color = "white",
    legend.title.color = "white",
    inner.margins = c(0.02, 0.02, 0.02, 0.02)
  )

Interpretasi:
Peta choropleth memperlihatkan pola spasial TPT Agustus. Warna lebih pekat = TPT lebih tinggi.

B. Visualisasi Data Numerik

B1. Histogram (TPT Februari 2025)

ggplot(df, aes(Feb_2025, fill = Feb_2025)) +
  geom_histogram(bins = 12, alpha = 0.92, color = "grey20") +
  labs(title = "Histogram TPT Februari 2025", x = "TPT (%)", y = "Frekuensi") +
  theme(legend.position = "none")

Interpretasi:
Histogram menunjukkan sebaran TPT Februari: puncak histogram = rentang TPT yang paling sering muncul.

B2. Density plot (Feb vs Aug)

ggplot(df_long, aes(TPT, fill = Periode)) +
  geom_density(alpha = 0.55) +
  labs(title = "Density TPT: Februari vs Agustus 2025",
       x = "TPT (%)", y = "Density")

Interpretasi:
Kurva bergeser ke kanan = periode dengan TPT lebih tinggi; kurva lebih lebar = variasi lebih besar.

B3. Boxplot (Feb vs Aug)

ggplot(df_long, aes(Periode, TPT, fill = Periode)) +
  geom_boxplot(width = 0.55, outlier.alpha = 0.75) +
  scale_y_continuous(labels = label_number(suffix = "%")) +
  labs(title = "Boxplot TPT: Februari vs Agustus 2025", x = NULL, y = "TPT") +
  theme(legend.position = "none")

Interpretasi:
Boxplot membandingkan median, IQR, dan outlier antar periode.

B4. Violin plot (Feb vs Aug)

ggplot(df_long, aes(Periode, TPT, fill = Periode)) +
  geom_violin(trim = FALSE, alpha = 0.85) +
  geom_boxplot(width = 0.12, outlier.size = 1) +
  labs(title = "Violin Plot TPT: Februari vs Agustus 2025", x = NULL, y = "TPT (%)") +
  theme(legend.position = "none")

Interpretasi:
Violin plot menunjukkan kepadatan data (bagian lebar = banyak provinsi di nilai itu) plus ringkasan boxplot.

B5. QQ-plot (normalitas TPT Agustus)

ggplot(df, aes(sample = Aug_2025)) +
  stat_qq(alpha = 0.85) +
  stat_qq_line() +
  labs(title = "QQ-Plot TPT Agustus 2025", x = "Theoretical Quantiles", y = "Sample Quantiles")

Interpretasi:
Titik mengikuti garis = distribusi mendekati normal; penyimpangan besar (ekor) = skew/outlier.

B6. Scatterplot (Feb vs Aug)

ggplot(df, aes(Feb_2025, Aug_2025)) +
  geom_point(aes(color = Aug_2025), size = 2.2, alpha = 0.9) +
  geom_smooth(method = "lm", se = FALSE, linewidth = 1.05, alpha = 0.9) +
  scale_x_continuous(labels = label_number(suffix = "%")) +
  scale_y_continuous(labels = label_number(suffix = "%")) +
  labs(title = "Scatterplot: TPT Februari vs Agustus 2025",
       x = "TPT Februari 2025", y = "TPT Agustus 2025", color = "TPT Aug")

Interpretasi:
Pola naik berarti provinsi yang tinggi di Februari cenderung tinggi juga di Agustus.

B7. Line chart (rata-rata TPT per periode)

avg_tpt <- df_long %>%
  group_by(Periode) %>%
  summarise(Rata2_TPT = mean(TPT, na.rm = TRUE), .groups = "drop")

ggplot(avg_tpt, aes(Periode, Rata2_TPT, group = 1)) +
  geom_line(linewidth = 1.25, alpha = 0.92) +
  geom_point(size = 3) +
  scale_y_continuous(labels = label_number(suffix = "%")) +
  labs(title = "Rata-rata TPT (Provinsi) Februari vs Agustus 2025",
       x = NULL, y = "Rata-rata TPT")

Interpretasi:
Garis naik = rata-rata TPT meningkat; garis turun = membaik.