Mata kuliah: Eksplorasi Dan Visualisasi Data
Kelas: A
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.
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…
## 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.