A script for visualising research trends
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
install.packages("europepmc") | |
install.packages("cowplot") | |
install.packages("tidyverse") | |
library(europepmc) | |
library(cowplot) | |
library(tidyverse) | |
ot_trend <- europepmc::epmc_hits_trend(query = "oxytocin", | |
period = 2008:2018) | |
# Standard plot | |
ot_trend %>% | |
ggplot(aes(year, query_hits / all_hits)) + | |
geom_point() + | |
geom_line() | |
# Nicer plot | |
ot_trend %>% | |
ggplot(aes(x = factor(year), y = (query_hits / all_hits))) + | |
geom_col(fill = "#56B4E9", width = 0.6, alpha = 0.9) + | |
scale_y_continuous(expand = c(0, 0)) + | |
theme_minimal_hgrid(12) + | |
labs(x = "Year", y = "Proportion of all published articles") + | |
ggtitle("Interest in oxytocin research over the past decade") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment