This is my replication of the tidytuesday graph from March 14, 2023 created by Jon Harmon on GitHub. It uses data from the European Medicines Agency via Miquel Anglada Girotto.
The original graph is very good: the two plots share a consistent theme, and they work together to tell a story about the evolution of orphan drugs over time.
p1 = ggplot(drugs, mapping = aes(x = orphan_medicine, fill = orphan_medicine)) + geom_bar() + scale_fill_manual(values = c("purple4", "gold")) + theme_minimal() + labs(title = "Approved orphan drugs (11.87%)", x = "orphan", y = "count") + theme(legend.position = "top")
p2 = ggplot(drugs, mapping = aes(x = marketing_authorisation_date, fill = orphan_medicine)) + geom_histogram(bins = 24, color = "white") + scale_fill_manual(values = c("purple4", "gold")) + theme_minimal() + labs(title = "Evolution of orphan drugs", x = "year", y = "count") + theme(legend.position = "none")
(p1 + p2)
In class, we talked about how stacked bar charts can be difficult to
read. I have swapped out the stacked bar chart for a side-by-side bar
chart, which I think shows the changes in amounts of orphan and
non-orphan drugs over the years. I also added alt text for both plots
and switched the theme to grey so that the boundaries of
the side-by-side plots were clearer.
#|fig-alt: Two graphs. The top graph is a histogram of orphan and non-orphan drugs: there are considerably more non-orphan drugs. The bottom graph is a side-by-side bar chart of orphan and non-orphan drugs created between 1998 and 2023. The amounts of both drugs have increased over time, but no orphan drugs are listed before 2014.
p1 = ggplot(drugs, mapping = aes(x = orphan_medicine, fill = orphan_medicine)) +
geom_bar() +
scale_fill_viridis_d() +
theme_grey() +
labs(title = "Approved orphan drugs (11.87%)", x = "orphan", y = "count") +
theme(legend.position = "top")
p2 = ggplot(drugs, mapping = aes(x = marketing_authorisation_date, fill = orphan_medicine)) + geom_histogram(bins = 24, color = "white") +
scale_fill_viridis_d() + theme_grey() +
facet_wrap(facets = "orphan_medicine") +
labs(title = "Evolution of orphan drugs", x = "year", y = "count") +
theme(legend.position = "none")
(p1/p2)