COVID-19 is a challenge of the year even in statistical visualization. One of the artlicles published on Wikipedia is dedicated to Statistics of the COVID-19 pandemic in the United States. At the above side of the web-page the following graph with the reference to Statista is presented:
This picture can be more informative, while there is a lack of representation that affect information perception.
Not changing a message of the graph, the following way to represent the same data is suggested:
library(tidyverse)
library(tibble)
# creating data frame
data <- data.frame(city = c("Michigan", "New York State",
"New Your City", "New Jersey", "Maryland",
"United States",
"Michigan", "New York State",
"New Your City", "New Jersey", "Maryland",
"United States"),
Case = c("excess deaths", "excess deaths", "excess deaths",
"excess deaths", "excess deaths", "excess deaths",
"reported","reported", "reported",
"reported", "reported", "reported"),
number = c(700, 1700, 6300, 2200, 300, 15400,
539, 1020, 2520, 836, 54, 8162))
# changing data types
data$city <- factor(data$city, levels = c("Michigan", "New York State",
"New Your City", "New Jersey", "Maryland",
"United States"))
data$Case <- factor(data$Case, levels = c("reported", "excess deaths"))
data$number <- as.numeric(data$number)
# plotting
ggplot() + geom_col(data = data, aes(x = city, y = number,
fill = Case),
width = 0.8,
color = "dimgray",
position = "dodge",
alpha = 0.9) +
scale_x_discrete(labels = c("Michigan", "New York State",
"New Your City", "New Jersey", "Maryland",
expression(bold("United States")))) +
geom_text(
aes(x = data$city,
y = data$number,
label = data$number,
group = data$Case),
position = position_dodge(width = 1),
hjust = -0.3,
vjust = -0.05,
size = 3,
color = "dimgray",
fontface = 3) +
coord_flip() +
ylim(0, 18000) +
xlab(" ") + ylab("Absolute values") +
ggtitle("U.S. COVID-19 Deaths Could Be Far Higher Than Reported") +
theme(legend.position = "bottom", legend.title = element_blank(),
plot.background = element_rect(fill = "#F4F8FB"),
legend.background = element_rect(fill = "#F4F8FB"),
strip.background = element_rect(fill = "#F4F8FB"),
panel.border = element_rect(color = NA, fill = NA),
panel.background = element_rect(fill = "#F4F8FB"),
plot.title = element_text(hjust = 0.5)) +
scale_fill_manual(values = c("#80080A", "#E97790"))
Maybe this plot is not so eye-catching as its previous version, the stated above issues are solved.