Migration Demographics In Canada
Graphs of migration demographics in Canada using STATCAN data
Data
STATCAN Table: 17-10-0009-01
STATCAN Table: 17-10-0008-01
STATCAN Table: 17-10-0015-01
STATCAN Table: 17-10-0121-01
STATCAN Table: 98-10-0361-01
Prepare Data
# devtools::install_github("derekmichaelwright/agData")
library(agData)
library(gganimate)
# Prep data
<- "www.dblogr.com/ or derekmichaelwright.github.io/dblogr/ | Data: STATCAN"
myCaption <- c("Births", "Deaths", "Emigrants", "Immigrants", "Net non-permanent residents")
myMeasures <- c("darkgreen", "black", "darkred", "steelblue", "darkblue")
myColors <- c("Canada", "Ontario", "Quebec", "New Brunswick", "Nova Scotia",
myAreas "Prince Edward Island", "Newfoundland and Labrador",
"British Columbia", "Alberta", "Saskatchewan", "Manitoba",
"Yukon", "NWT & Nunavut", "Northwest Territories", "Nunavut")
<- c("0 to 4 years", "5 to 9 years",
myAges "10 to 14 years", "15 to 19 years",
"20 to 24 years", "25 to 29 years",
"30 to 34 years", "35 to 39 years",
"40 to 44 years", "45 to 49 years",
"50 to 54 years", "55 to 59 years",
"60 to 64 years", "65 to 69 years",
"70 to 74 years", "75 to 79 years",
"80 to 84 years", "85 to 89 years",
"90 to 94 years", "95 to 99 years",
"100 years and over")
<- c("1975/1976","1980/1981","1985/1986","1990/1991","1995/1996",
myDates "2000/2001","2005/2006","2010/2011","2015/2016", "2020/2021")
#
<- read.csv("1710000901_databaseLoadingData.csv") %>%
d1 select(Year=1, Area=GEO, Unit=UOM, Value=VALUE) %>%
mutate(Area = gsub("Northwest Territories including", "NWT &", Area),
Area = factor(Area, levels = myAreas),
Month = substr(Year, 6, 8),
Year = substr(Year, 1,4),
Year = as.numeric(Year),
Month = as.numeric(Month),
Date = as.Date(paste(Year, Month, "01", sep = "-")))
<- d1 %>% group_by(Area, Year) %>%
pp summarise(Population = mean(Value, na.rm = T))
#
<- read.csv("1710000801_databaseLoadingData.csv") %>%
d2 select(Date=REF_DATE, Area=GEO, Measurement=Components.of.population.growth,
Unit=UOM, Value=VALUE) %>%
mutate(Area = gsub("Northwest Territories including", "NWT &", Area),
Area = factor(Area, levels = myAreas),
Year = as.numeric(substr(Date, 1,4)),
Date = factor(Date))
#
<- read.csv("1710001501_databaseLoadingData.csv") %>%
d3 select(Year=1, Area=GEO, Sex, Age=Age.group,
Measurement=Migrants, UOM, Value=VALUE) %>%
mutate(Area = gsub("Northwest Territories including", "NWT &", Area),
Age = factor(Age, levels = myAges),
Net = ifelse(Value > 0, "Positive", "Negative"))
#
<- read.csv("1710012101_databaseLoadingData.csv") %>%
d4 select(Date=REF_DATE, Area=GEO,
Type=Non.permanent.resident.types,
Value=VALUE) %>%
UOM, mutate(Area = gsub("Northwest Territories including", "NWT &", Area),
Area = factor(Area, levels = myAreas),
Date = factor(Date))
#
<- c("Total - Age", "0 to 14 years", "15 to 24 years",
myAges "25 to 64 years", "65 years and over")
<- read.csv("9810036101_databaseLoadingData.csv") %>%
d5 select(Year=1, Area=GEO, Sex=Gender..3., Age=Age..15C.,
Type=Non.permanent.resident.type..10.,
POB=Place.of.birth..290., UOM, Value=VALUE) %>%
mutate(Area = gsub("Northwest Territories including", "NWT &", Area),
Age = factor(Age, levels = myAges),
Sex = gsub("+", "", Sex))
Births, Deaths & Migration
Canada
# Prep data
<- d2 %>%
xx filter(Area == "Canada", Measurement %in% myMeasures) %>%
mutate(Measurement = factor(Measurement, levels = myMeasures))
# Plot
<- ggplot(xx, aes(x = Date, y = Value / 1000)) +
mp geom_line(aes(color = Measurement, group = Measurement), line.width = 1, alpha = 0.7) +
geom_line(y = 0, lty = 2, alpha = 0.7, color = "black") +
scale_color_manual(name = NULL, values = myColors) +
scale_x_discrete(breaks = myDates) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Canada - Population Dynamics", x = NULL,
y = "Thousand People", caption = myCaption)
ggsave("canada_migration_1_01.png", mp, width = 6, height = 4)
Provinces
# Prep data
<- d2 %>% filter(Measurement %in% myMeasures)
xx # Plot
<- ggplot(xx, aes(x = Date, y = Value / 1000)) +
mp geom_line(aes(color = Measurement, group = Measurement), line.width = 1, alpha = 0.7) +
geom_line(y = 0, lty = 2, alpha = 0.7, color = "black") +
facet_wrap(Area ~ ., ncol = 5, scales = "free_y") +
scale_color_manual(name = NULL, values = myColors) +
scale_x_discrete(breaks = myDates) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Population Dynamics", x = NULL,
y = "Thousand People", caption = myCaption)
ggsave("canada_migration_1_02.png", mp, width = 14, height = 6)
Immigrants vs Emigrants
Canada
# Prep data
<- d2 %>%
xx filter(Area == "Canada", Measurement %in% c("Immigrants", "Emigrants")) %>%
mutate(Value = ifelse(Measurement == "Emigrants", -Value, Value))
# Plot
<- ggplot(xx, aes(x = Date, y = Value / 1000, fill = Measurement)) +
mp geom_hline(yintercept = 0) +
geom_col(alpha = 0.7, color = "black", lwd = 0.3) +
scale_fill_manual(name = NULL, values = myColors[3:4]) +
scale_x_discrete(breaks = myDates) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Canada - Net Migration", x = NULL,
y = "Thousand People", caption = myCaption)
ggsave("canada_migration_1_03.png", mp, width = 6, height = 4)
Provinces
# Prep data
<- d2 %>%
xx filter(Measurement %in% c("Immigrants", "Emigrants")) %>%
mutate(Value = ifelse(Measurement == "Emigrants", -Value, Value))
# Plot
<- ggplot(xx, aes(x = Date, y = Value / 1000, fill = Measurement)) +
mp geom_hline(yintercept = 0) +
geom_col(alpha = 0.7, color = "black", lwd = 0.1) +
facet_wrap(Area ~ ., ncol = 5, scales = "free_y") +
scale_fill_manual(name = NULL, values = myColors[3:4]) +
scale_x_discrete(breaks = myDates) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Net Migration", x = NULL,
y = "Thousand People", caption = myCaption)
ggsave("canada_migration_1_04.png", mp, width = 14, height = 6)
Net Migration
# Prep data
<- d2 %>%
xx filter(Measurement %in% c("Immigrants", "Emigrants")) %>%
spread(Measurement, Value) %>%
mutate(Net = Immigrants - Emigrants,
Group = ifelse(Net > 0, "Pos", "Neg"))
# Plot
<- ggplot(xx, aes(x = Date, y = Net / 1000, fill = Group)) +
mp geom_hline(yintercept = 0) +
geom_col(alpha = 0.7, color = "black", lwd = 0.1) +
facet_wrap(Area ~ ., ncol = 5, scales = "free_y") +
scale_fill_manual(name = NULL, values = myColors[3:4]) +
scale_x_discrete(breaks = myDates) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Net Migration", x = NULL,
y = "Thousand People", caption = myCaption)
ggsave("canada_migration_1_05.png", mp, width = 14, height = 6)
Prairies vs. Non-Prairies
# Prep data
<- c("steelblue", "red", "darkorange",
myC "darkblue", "darkgreen", "darkred")
<- c("Quebec", "Ontario", "British Columbia",
myA "Alberta", "Saskatchewan", "Manitoba")
<- c("NonPrairies", "NonPrairies", "NonPrairies",
myW "Prairies", "Prairies", "Prairies")
<- d1 %>%
x1 filter(Month == 1) %>%
select(Area, Year, Population=Value)
<- d2 %>%
x2 filter(Measurement == "Immigrants") %>%
select(Area, Year, Immigrants=Value)
<- left_join(x1, x2, by = c("Area", "Year")) %>%
xx filter(Area %in% myA, !is.na(Immigrants)) %>%
mutate(Value = 1000000 * Immigrants / Population,
Area = factor(Area, levels = myA),
Wing = plyr::mapvalues(Area, myA, myW))
# Plot
<- ggplot(xx, aes(x = Year, y = Value, color = Area)) +
mp geom_line(alpha = 0.2) +
geom_smooth(se = F) +
facet_grid(. ~ Wing) +
scale_x_continuous(breaks = seq(1975, 2015, 10)) +
scale_color_manual(name = NULL, values = myC) +
theme_agData() +
labs(title = "Immigration Rates", x = NULL,
y = "Immigrants / Million People", caption = myCaption)
ggsave("canada_migration_1_06.png", mp, width = 8, height = 4)
Non-Permentant Residents
Canada
# Prep data
<- d2 %>%
xx filter(Area == "Canada",
%in% c("Immigrants", "Net non-permanent residents"))
Measurement # Plot
<- ggplot(xx, aes(x = Date, y = Value / 1000, fill = Measurement)) +
mp geom_hline(yintercept = 0, line.width = 0.5) +
geom_col(color = "black", alpha = 0.7, lwd = 0.3) +
scale_fill_manual(name = NULL, values = c("darkred", "steelblue")) +
scale_x_discrete(breaks = myDates) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Canada - Immigrants & Non-Permanent Residents",
y = "Thousand People", x = NULL, caption = myCaption)
ggsave("canada_migration_1_07.png", mp, width = 6, height = 4)
Provinces
# Prep data
<- d2 %>%
xx filter(Measurement %in% c("Immigrants", "Net non-permanent residents"))
# Plot
<- ggplot(xx, aes(x = Date, y = Value / 1000, fill = Measurement)) +
mp geom_hline(yintercept = 0, line.width = 0.5) +
geom_col(color = "black", alpha = 0.7, lwd = 0.3) +
facet_wrap(Area ~ ., scales = "free_y", ncol = 5) +
scale_fill_manual(name = NULL, values = c("darkred", "steelblue")) +
scale_x_discrete(breaks = myDates) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Immigrants & Non-Permanent Residents",
y = "Thousand People", x = NULL, caption = myCaption)
ggsave("canada_migration_1_08.png", mp, width = 12, height = 5)
Net Interprovincial Migration
# Prep data
<- d2 %>%
xx filter(Area != "Canada",
== "Net interprovincial migration") %>%
Measurement mutate(Group = ifelse(Value > 0, "Pos", "Neg"))
# Plot
<- ggplot(xx, aes(x = Date, y = Value / 1000, fill = Group)) +
mp geom_hline(yintercept = 0) +
geom_col(alpha = 0.7, color = "black", lwd = 0.1) +
facet_wrap(Area ~ ., ncol = 5, scales = "free_y") +
scale_fill_manual(name = NULL, values = c("darkred", "steelblue")) +
scale_x_discrete(breaks = myDates) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Net Interprovincial Migration", x = NULL,
y = "Thousand People", caption = myCaption)
ggsave("canada_migration_1_09.png", mp, width = 12, height = 6)
Alberta vs BC
# Prep data
<- d2 %>%
xx filter(Area %in% c("Alberta", "British Columbia"),
== "Net interprovincial migration")
Measurement # Plot
<- ggplot(xx, aes(x = Date, y = Value / 1000, color = Area, group = Area)) +
mp geom_hline(yintercept = 0) +
geom_line(alpha = 0.7) +
scale_color_manual(name = NULL, values = c("darkorange", "darkblue")) +
scale_x_discrete(breaks = myDates) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Net Interprovincial Migration", x = NULL,
y = "Thousand People", caption = myCaption)
ggsave("canada_migration_1_10.png", mp, width = 6, height = 4)
Interprovincial Migration By Age
Gifs
# Create plotting function
<- function(myArea) {
ggInterProv_ani #Prep data
<- d3 %>%
xx filter(Area == myArea, Measurement == "Net-migration",
== "Both sexes", Age != "All ages") %>%
Sex mutate(YearNum = as.numeric(substr(Year,1,4)))
# Plot
ggplot(xx, aes(x = Age, y = Value / 1000, fill = Net)) +
geom_col(color = "black", alpha = 0.7) +
scale_fill_manual(values = c("darkred", "steelblue")) +
theme_agData(legend.position = "none",
axis.text.x = element_text(angle = 45, hjust = 1, size = 5)) +
labs(title = paste(myArea, "- {round(frame_time)}"),
subtitle = "Net Interprovincial Migration",
y = "Thousand People", x = NULL, caption = myCaption) +
transition_time(YearNum)
}
British Columbia
<- ggInterProv_ani("British Columbia")
mp anim_save("canada_migration_gif_01.gif", mp,
nframes = 600, fps = 10, end_pause = 10,
width = 900, height = 600, res = 150)
Alberta
<- ggInterProv_ani("Alberta")
mp anim_save("canada_migration_gif_02.gif", mp,
nframes = 600, fps = 10, end_pause = 10,
width = 900, height = 600, res = 150)
Saskatchewan
<- ggInterProv_ani("Saskatchewan")
mp anim_save("canada_migration_gif_03.gif", mp,
nframes = 600, fps = 10, end_pause = 10,
width = 900, height = 600, res = 150)
Manitoba
<- ggInterProv_ani("Manitoba")
mp anim_save("canada_migration_gif_04.gif", mp,
nframes = 600, fps = 10, end_pause = 10,
width = 900, height = 600, res = 150)
Ontario
<- ggInterProv_ani("Ontario")
mp anim_save("canada_migration_gif_05.gif", mp,
nframes = 600, fps = 10, end_pause = 10,
width = 900, height = 600, res = 150)
Quebec
<- ggInterProv_ani("Quebec")
mp anim_save("canada_migration_gif_06.gif", mp,
nframes = 600, fps = 10, end_pause = 10,
width = 900, height = 600, res = 150)
Facetted
# Create plotting function
<- function(myArea) {
ggInterProv #Prep data
<- d3 %>%
xx filter(Area == myArea, Year != "1971/1972",
== "Both sexes", Age != "All ages",
Sex == "Net-migration")
Measurement # Plot
ggplot(xx, aes(x = Age, y = Value / 1000, fill = Net)) +
geom_col(color = "black", alpha = 0.7) +
facet_wrap(. ~ Year, ncol = 10) +
scale_fill_manual(values = c("darkred", "steelblue")) +
theme_agData(legend.position = "none",
axis.text.x = element_text(angle = 45, hjust = 1, size = 5)) +
labs(title = paste(myArea, "- Net Interprovincial Migration"), x = NULL,
y = "Thousand People", caption = myCaption)
}
British Columbia
# Plot
<- ggInterProv(myArea = "British Columbia")
mp ggsave("canada_migration_2_01.png", mp, width = 20, height = 10)
Alberta
# Plot
<- ggInterProv(myArea = "Alberta")
mp ggsave("canada_migration_2_02.png", mp, width = 20, height = 10)
Saskatchewan
# Plot
<- ggInterProv(myArea = "Saskatchewan")
mp ggsave("canada_migration_2_03.png", mp, width = 20, height = 10)
Manitoba
# Plot
<- ggInterProv(myArea = "Manitoba")
mp ggsave("canada_migration_2_04.png", mp, width = 20, height = 10)
Ontario
# Plot
<- ggInterProv(myArea = "Ontario")
mp ggsave("canada_migration_2_04.png", mp, width = 20, height = 10)
Quebec
# Plot
<- ggInterProv(myArea = "Quebec")
mp ggsave("canada_migration_2_05.png", mp, width = 20, height = 10)
Alberta 2012 - 2020
# Prep data
<- c(c("2012/2013", "2013/2014", "2014/2015", "2015/2016", "2017/2018",
myYears "2018/2019", "2019/2020", "2020/2021", "2021/2022"))
<- d3 %>%
xx filter(Area == "Alberta", Year %in% myYears,
== "Both sexes", Age != "All ages",
Sex == "Net-migration")
Measurement # Plot
<- ggplot(xx, aes(x = Age, y = Value, fill = Net)) +
mp geom_col(color = "black", alpha = 0.7) +
facet_wrap(. ~ Year, ncol = 3) +
scale_fill_manual(values = c("darkred", "steelblue")) +
theme_agData(legend.position = "none",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Alberta Net Interprovincial Migration",
y = "Thousand People", x = NULL, caption = myCaption)
ggsave("canada_migration_2_06.png", mp, width = 10, height = 8)
2021 - 2022
Alberta
# Prep data
<- d3 %>%
xx filter(Area == "Alberta", Year %in% c("2020/2021", "2021/2022"),
== "Both sexes", Age != "All ages",
Sex == "Net-migration")
Measurement # Plot
<- ggplot(xx, aes(x = Age, y = Value, fill = Net)) +
mp geom_col(color = "black", alpha = 0.7) +
facet_grid(. ~ Year) +
scale_fill_manual(values = myColors[3:4]) +
theme_agData(legend.position = "none",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Alberta Net Interprovincial Migration",
y = "Thousand People", x = NULL, caption = myCaption)
ggsave("canada_migration_2_07.png", mp, width = 8, height = 4)
Ontario
# Prep data
<- d3 %>%
xx filter(Area == "Ontario", Year %in% c("2020/2021", "2021/2022"),
== "Both sexes", Age != "All ages",
Sex == "Net-migration")
Measurement # Plot
<- ggplot(xx, aes(x = Age, y = Value, fill = Net)) +
mp geom_col(color = "black", alpha = 0.7) +
facet_grid(. ~ Year) +
scale_fill_manual(values = myColors[3:4]) +
theme_agData(legend.position = "none",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Ontario Net Interprovincial Migration", x = NULL,
y = "Thousand People", caption = myCaption)
ggsave("canada_migration_2_08.png", mp, width = 8, height = 4)
Birth Rates
Canada
# Prep data
<- d2 %>% filter(Measurement == "Births") %>%
xx left_join(pp, by = c("Area","Year")) %>%
mutate(BirthRate = 1000 * Value / Population)
# Plot
<- ggplot(xx %>% filter(Area == "Canada"), aes(Date, y = BirthRate)) +
mp geom_col(color = "black", fill = "darkgreen", alpha = 0.7, lwd = 0.2) +
scale_x_discrete(breaks = myDates) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
theme_agData() +
labs(title = "Birth Rate in Canada", x = NULL,
y = "Births / Thousand People", caption = myCaption)
ggsave("canada_migration_3_01.png", mp, width = 6, height = 4)
Birth Rates
# Prep data
<- d2 %>% filter(Measurement == "Births") %>%
x1 select(Year, Area, Births=Value)
<- d1 %>% filter(Month == 1) %>%
x2 select(Year, Area, Population=Value)
<- left_join(x1, x2, by = c("Year", "Area")) %>%
xx mutate(BirthRate = Births / Population)
# Plot
<- ggplot(xx, aes(x = Year, y = BirthRate * 1000)) +
mp geom_col(alpha = 0.7, fill = "darkgreen") +
facet_wrap(Area ~ ., scales = "free_y", ncol = 5) +
scale_x_discrete(breaks = myDates) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Birth Rates", x = NULL,
y = "Births / Thousand People", caption = myCaption)
ggsave("canada_migration_3_02.png", mp, width = 14, height = 6)
Saskatchewan
# Prep data
<- d2 %>%
xx filter(Area == "Saskatchewan", Measurement %in% c("Births","Deaths"))
# Plot
<- ggplot(xx, aes(x = Date, y = Value / 1000,
mp color = Measurement, group = Measurement)) +
geom_line(line.width = 1.5, alpha = 0.7, size = 1.5) +
scale_color_manual(name = NULL, values = myColors) +
scale_y_continuous(minor_breaks = 0:20, limits = c(0.5,18.5)) +
scale_x_discrete(breaks = myDates) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Population Dynamics in Saskatchewan",
y = "Thousand People", x = NULL, caption = myCaption)
ggsave("canada_migration_3_03.png", mp, width = 6, height = 4)
British Columbia
# Prep data
<- d2 %>%
xx filter(Area == "British Columbia", Measurement %in% c("Births","Deaths"))
# Plot
<- ggplot(xx, aes(x = Date, y = Value / 1000,
mp color = Measurement, group = Measurement)) +
geom_line(line.width = 1.5, alpha = 0.7, size = 1.5) +
scale_color_manual(name = NULL, values = myColors) +
scale_y_continuous(limits = c(1,48)) +
scale_x_discrete(breaks = myDates) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Population Dynamics in The Maritimes",
y = "Thousand People", x = NULL, caption = myCaption)
ggsave("canada_migration_3_04.png", mp, width = 6, height = 4)
Maritimes
# Prep data
<- d2 %>%
xx filter(Measurement %in% c("Births","Deaths"),
%in% c("Prince Edward Island", "Nova Scotia", "New Brunswick",
Area "Newfoundland and Labrador")) %>%
group_by(Date, Measurement) %>%
summarise(Value = sum(Value))
# Plot
<- ggplot(xx, aes(x = Date, y = Value / 1000,
mp color = Measurement, group = Measurement)) +
geom_line(line.width = 1.5, alpha = 0.7, size = 1.5) +
scale_color_manual(name = NULL, values = myColors) +
scale_y_continuous(limits = c(1,42)) +
scale_x_discrete(breaks = myDates) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Population Dynamics in The Maritimes",
y = "Thousand People", x = NULL, caption = myCaption)
ggsave("canada_migration_3_05.png", mp, width = 6, height = 4)
Non-permentant Residents
Canada
# Prep Data
<- d4 %>%
xx filter(Area == "Canada", Type != "Total, non-permanent residents")
# Plot
<- ggplot(xx, aes(x = Date, y = Value / 1000000, fill = Type)) +
mp geom_col(color = "black", alpha = 0.7) +
scale_fill_manual(name = NULL, values = c("darkred", "steelblue")) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Canada", subtitle = "Total, non-permanent residents",
y = "Million People", x = NULL, caption = myCaption)
ggsave("canada_migration_4_01.png", mp, width = 6, height = 5)
Provinces
# Prep Data
<- d4 %>%
xx filter(Type != "Total, non-permanent residents")
# Plot
<- ggplot(xx, aes(x = Date, y = Value / 1000, fill = Type)) +
mp geom_col(color = "black", alpha = 0.7) +
facet_wrap(Area ~ ., ncol = 7, scales = "free_y") +
scale_fill_manual(name = NULL, values = c("darkred", "steelblue")) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Canada", subtitle = "Total, non-permanent residents",
x = NULL, y = "Thousand People", caption = myCaption)
ggsave("canada_migration_4_02.png", mp, width = 14, height = 6)
Assylum Seekers
Canada
# Prep Data
<- d4 %>%
xx filter(Area == "Canada", Type == "Total, asylum claimants")
# Plot
<- ggplot(xx, aes(x = Date, y = Value / 1000)) +
mp geom_col(color = "black", fill = "darkred", alpha = 0.7) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Total, asylum claimants", x = NULL,
y = "Thousand People", caption = myCaption)
ggsave("canada_migration_4_03.png", mp, width = 6, height = 4)
Provinces
# Prep Data
<- d4 %>%
xx filter(Type == "Total, asylum claimants")
# Plot
<- ggplot(xx, aes(x = Date, y = Value / 1000)) +
mp geom_col(color = "black", fill = "darkred", alpha = 0.7) +
facet_wrap(Area ~ ., ncol = 7, scales = "free_y") +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Total, asylum claimants", x = NULL,
y = "Thousand People", caption = myCaption)
ggsave("canada_migration_4_04.png", mp, width = 14, height = 6)