Click the Original, Code and Reconstruction tabs to read about the issues and how they were fixed.
Objective
The purpose of this visualisation is to identify the immigration patterns of residents who were born outside the UK over the past 60 years. The targetted audience is relevant to those who want to improve their understanding of how historical changes in the UK’s foreign born residents have contributed to the 2011 population structure of England and Wales including policy makers, members of Parliament, journalists, researchers and academics, etc.
The visualisation chosen had the following three main issues:
Reference
The following code was used to fix the issues identified in the original.
library(readr)
library(ggplot2)
immigrant <- read_csv("C:/Users/Lisa/Downloads/MATH2270 Data Vis/Assignment 2/original.csv")
immigrant$year <- factor(immigrant$year, levels=c("pre 1961", "1961-1970", "1971-1980", "1981-1990", "1991-2000", "2001-2003", "2004-2006", "2007-2009", "2010-2011"), ordered = TRUE)
# plot the distribution of migrants
# by country using line/point plots
ggplot(immigrant, aes(x = year, y = percent, color = factor(country))) +
geom_line(aes(group = country))+
geom_point() +
labs(title = "When did Immigrants first arrive in the UK(England and Wales)?",
subtitle = "Before 1961 to 2011",
x = "Year",
y = "Percent",
caption = "Source: Nomis, Office for National Statistics (2013)\n*After 2001, the data was collected every 2 years." ) +
scale_y_continuous(n.breaks = 8) +
facet_wrap(. ~ country, ncol = 3) +
geom_label(aes(label = country), x = Inf, y = Inf, hjust = 1, vjust = 1, size = 3) +
theme(
legend.position = "none",
plot.title = element_text(hjust = 0.5,
size = 14,
face = "bold"),
plot.subtitle = element_text(hjust = 0.5),
plot.caption = element_text(hjust = 0,
face = "italic"),
axis.text.x = element_text(angle = 45,
vjust = 1,
hjust = 1,
size = 6.5),
strip.background = element_blank(),
strip.text = element_blank()) +
scale_color_manual(values = c("#6D6875", "#d18066", "#d18066","#d18066","#d18066","#d18066", "#d18066", "#d18066", "#d18066", "#d18066", "#d18066"))
Data Reference
The following plot fixes the main issues in the original.
The visualisation addresses the main issues in the original: