Data = read.table(file.choose(), header = TRUE)
Data
## Provinsi Tenaga_Medis
## 1 Aceh 21
## 2 Sumatera_Utara 24
## 3 Sumatera_Barat 12
## 4 Riau 13
## 5 Jambi 8
## 6 Sumatera_Selatan 17
## 7 Bengkulu 5
## 8 Lampung 13
## 9 Kepulauan_Bangka_Belitung 4
## 10 Kepulauan_Riau 5
## 11 DKI_Jakarta 39
## 12 Jawa_Barat 74
## 13 Jawa_Tengah 66
## 14 DI_Yogyakarta 12
## 15 Jawa_Timur 74
## 16 Banten 19
## 17 Bali 13
## 18 Nusa_Tenggara_Barat 13
## 19 Nusa_Tenggara_Timur 16
## 20 Kalimantan_Barat 11
## 21 Kalimantan_Tengah 8
## 22 Kalimantan_Selatan 10
## 23 Kalimantan_Timur 11
## 24 Kalimantan_Utara 3
## 25 Sulawesi_Utara 10
## 26 Sulawesi_Tengah 9
## 27 Sulawesi_Selatan 27
## 28 Sulawesi_Tenggara 10
## 29 Gorontalo 4
## 30 Sulawesi_Barat 4
## 31 Maluku 7
## 32 Maluku_Utara 4
## 33 Papua_Barat 2
## 34 Papua_Barat_Daya 2
## 35 Papua 4
## 36 Papua_Selatan 2
## 37 Papua_Tengah 3
## 38 Papua_Pegunungan 1
library(ggplot2)
ggplot(Data, aes(
x = Tenaga_Medis,
y = reorder(Provinsi, Tenaga_Medis)
)) +
geom_col(
fill = "red",
color = "black",
width = 0.6
) +
labs(
title = "Jumlah Tenaga Medis Menurut Provinsi di Indonesia",
x = "Jumlah Tenaga Medis",
y = "Provinsi"
) +
theme_classic() +
theme(
axis.text.y = element_text(size = 7),
axis.text.x = element_text(size = 9),
axis.title = element_text(face = "bold"),
plot.title = element_text(
hjust = 0.5,
face = "bold",
size = 14
)
)
library(ggplot2)
ggplot(Data, aes(x = Tenaga_Medis)) +
geom_histogram(
binwidth = 5,
boundary = 0,
fill = "red",
color = "black"
) +
scale_x_continuous(
breaks = seq(0, 75, by = 5),
limits = c(0, 75)
) +
labs(
title = "Distribusi Jumlah Tenaga Medis di Indonesia",
x = "Jumlah Tenaga Medis",
y = "Freq"
) +
theme_classic() +
theme(
axis.text.x = element_text(
angle = 0,
hjust = 0.5
),
plot.title = element_text(
hjust = 0.5,
face = "bold"
)
)
library(dplyr)
##
## 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(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.1 ✔ stringr 1.6.0
## ✔ lubridate 1.9.5 ✔ tibble 3.3.1
## ✔ purrr 1.2.2 ✔ tidyr 1.3.2
## ✔ readr 2.2.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggplot2)
Data_Kalimantan <- Data %>%
filter(str_starts(Provinsi, "Kalimantan"))
Data_Kalimantan
## Provinsi Tenaga_Medis
## 1 Kalimantan_Barat 11
## 2 Kalimantan_Tengah 8
## 3 Kalimantan_Selatan 10
## 4 Kalimantan_Timur 11
## 5 Kalimantan_Utara 3
ggplot(Data_Kalimantan, aes(x = Provinsi, y = Tenaga_Medis, fill = Provinsi)) +
geom_col() +
labs(
title = "Jumlah Tenaga Medis di Pulau Kalimantan",
x = "Provinsi",
y = "Jumlah Tenaga Medis"
) +
scale_fill_manual(
values = c(
"Kalimantan_Barat" = "pink",
"Kalimantan_Tengah" = "lightblue",
"Kalimantan_Selatan" = "lightgreen",
"Kalimantan_Timur" = "plum",
"Kalimantan_Utara" = "khaki"
)
) +
theme_minimal() +
theme(
axis.text.x = element_text(angle = 45, hjust = 1),
plot.title = element_text(hjust = 0.5, face = "bold"),
legend.position = "none"
)