Data = read.table(file.choose(), header = T)
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.5.3
# Mengubah TPT dari teks menjadi angka
Data$TPT <- as.numeric(gsub(",", ".", Data$TPT))
# Membuat kelompok provinsi
Data$Kelompok <- ifelse(
grepl("^Kalimantan", Data$Provinsi),
"Kalimantan",
"Provinsi Lain"
)
ggplot(
Data,
aes(
x = reorder(Provinsi, TPT),
y = TPT,
fill = Kelompok
)
) +
geom_col() +
geom_text(
aes(label = paste0(TPT, "%")),
hjust = -0.15,
size = 3.2
) +
coord_flip() +
labs(
title = "Tingkat Pengangguran Terbuka (TPT)",
subtitle = "Perbandingan TPT pada 38 Provinsi di Indonesia",
x = NULL,
y = "TPT (%)",
fill = NULL,
caption = "Sumber: Data TPT yang digunakan dalam analisis"
) +
scale_fill_manual(
values = c(
"Kalimantan" = "orange",
"Provinsi Lain" = "grey70"
)
) +
scale_y_continuous(
expand = expansion(mult = c(0, 0.08))
) +
theme_minimal() +
theme(
plot.title = element_text(
size = 17,
face = "bold"
),
plot.subtitle = element_text(
size = 11
),
axis.text.y = element_text(size = 9),
axis.text.x = element_text(size = 9),
axis.title.x = element_text(
size = 10,
face = "bold"
),
panel.grid.major.y = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top",
plot.caption = element_text(
size = 9,
hjust = 0
)
)

library(dplyr)
## Warning: package 'dplyr' was built under R version 4.5.3
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
Data_Kalimantan <- Data %>%
filter(grepl("^Kalimantan", Provinsi))
ggplot(Data_Kalimantan, aes(x = "Kalimantan", y = TPT)) +
geom_boxplot(
width = 0.4,
fill = "lightblue",
color = "darkblue"
) +
geom_jitter(
aes(color = Provinsi),
width = 0.08,
size = 4
) +
geom_text(
aes(
label = paste0(Provinsi, " (", TPT, "%)"),
color = Provinsi
),
position = position_jitter(width = 0.08),
hjust = -0.1,
size = 3.5,
show.legend = FALSE
) +
labs(
title = "Distribusi Tingkat Pengangguran Terbuka di Kalimantan",
subtitle = "TPT 5 Provinsi di Pulau Kalimantan",
x = NULL,
y = "TPT (%)",
color = "Provinsi"
) +
theme_minimal() +
theme(
plot.title = element_text(size = 16, face = "bold"),
plot.subtitle = element_text(size = 11),
panel.grid.minor = element_blank(),
legend.position = "right"
)
