Data Source: Korean Statistics Information Service

For more information: Han Gang Magazine

Contact:

library(ggplot2)
library(tidyr)
library(RColorBrewer)
library(ggsci)
# load foreigners-seoul
foreigners_seoul <- read.csv("foreigners-seoul.csv")
foreigners_seoul
##   Year  Total   Male Female
## 1 2015 274957 132607 142350
## 2 2016 273441 130590 142851
## 3 2017 267153 127651 139502
## 4 2018 283984 136950 147034
## 5 2019 281876 133666 148210
## 6 2020 242623 114799 127824
## 7 2021 229610 107332 122278
# load foreigners-korea
foreigners_korea <- read.csv("foreigners-korea.csv")
foreigners_korea
##   Year   Total   Male Female
## 1 2015 1143087 656265 486822
## 2 2016 1161677 664800 496877
## 3 2017 1171762 671426 500336
## 4 2018 1246626 716525 530101
## 5 2019 1271807 727281 544526
# foreigners-seoul plot
foreigners_seoul_plot <- foreigners_seoul |>
  gather("Gender", "Population", -Year) |>
  ggplot(aes(x= Year, y = Population, fill = Gender)) +
  geom_bar(width = 0.7, position = "dodge", stat = "identity") +
  theme_minimal() +
  labs(title = "Registered Foreign Nationals in Seoul", 
       x = "Year", y = "Population") + 
  theme(plot.title = element_text(face = "bold"),
        axis.title.x = element_text(face = "bold"),
        axis.title.y = element_text(face = "bold"),
        legend.title = element_text(face = "bold")
  ) +
  coord_cartesian(ylim = c(0, 300000)) +
  scale_y_continuous(limits = c(0, 300000), breaks=seq(0, 300000, 50000)) +
  scale_fill_manual(values = c("Female" = "#ff69b4", 
                               "Male" = "#00bfff",
                               "Total" = "#90ee90"))

foreigners_seoul_plot

# foreigners-korea plot
foreigners_korea_plot <- foreigners_korea |>
  gather("Gender", "Population", -Year) |>
  ggplot(aes(x= Year, y = Population, fill = Gender)) +
  geom_bar(width = 0.7, position = "dodge", stat = "identity") +
  theme_minimal() +
  labs(title = "Registered Foreign Nationals in Korea", 
       x = "Year", y = "Population") + 
  theme(plot.title = element_text(face = "bold"),
        axis.title.x = element_text(face = "bold"),
        axis.title.y = element_text(face = "bold"),
        legend.title = element_text(face = "bold")
  ) +
  coord_cartesian(ylim = c(0, 1800000)) +
  scale_y_continuous(limits = c(0, 1800000), breaks=seq(0, 1800000, 500000)) +
  scale_fill_manual(values = c("Female" = "#ff69b4", 
                               "Male" = "#00bfff",
                               "Total" = "#90ee90"))

foreigners_korea_plot