Skip to content

Commit

Permalink
Figure updates
Browse files Browse the repository at this point in the history
- Corrected small translation issues in date scales
- Added new panels to Supp. Fig. 3 showing views and downloads in month of preprint posting
  • Loading branch information
nicholasmfraser committed Mar 4, 2021
1 parent ce6a641 commit e867a9f
Show file tree
Hide file tree
Showing 43 changed files with 85 additions and 33 deletions.
118 changes: 85 additions & 33 deletions figures.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,6 @@ p2E <- preprints %>%
scale_x_date(date_breaks = "1 month",
date_minor_breaks = "1 month",
date_labels = "%b") +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
ggsave("outputs/figures/partials/Figure_2E.png", width = 10, height = 4)
# Panel F: Reference counts
Expand All @@ -482,7 +481,6 @@ p2F <- preprints %>%
scale_x_date(date_breaks = "1 month",
date_minor_breaks = "1 month",
date_labels = "%b") +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
ggsave("outputs/figures/partials/Figure_2F.png", width = 10, height = 4)
p <- p2A + p2B + p2C + p2D + p2E + p2F +
Expand Down Expand Up @@ -654,17 +652,18 @@ p3B <- preprints %>%
posted_date <= analysis_end,
institution_match_country_code %in% top_n_countries) %>%
count(institution_match_country_code, covid_preprint) %>%
group_by(institution_match_country_code) %>%
mutate(total_n = sum(n)) %>%
group_by(covid_preprint) %>%
mutate(total_n = sum(n),
proportion = (n/sum(n))*100) %>%
ungroup() %>%
mutate(continent = countrycode::countrycode(institution_match_country_code,
origin = 'iso2c',
destination = 'continent')) %>%
assign_covid_preprint() %>%
ggplot(aes(x = reorder(institution_match_country_code, -n), y = n, fill = covid_preprint)) +
ggplot(aes(x = reorder(institution_match_country_code, -n), y = proportion, fill = covid_preprint)) +
geom_col(color = "grey50", position = position_dodge(preserve = "single"),
width = 0.75, size = 0.25) +
labs(x = "Country of corresponding author", y = "Preprints deposited", fill = "") +
labs(x = "Country of corresponding author", y = "% of preprints", fill = "") +
scale_fill_manual(values = qualitative_hcl(2, palette = "Set2")) +
theme(legend.position = "top") +
ggsave("outputs/figures/partials/Figure_3B.png", width = 5, height = 4)
Expand Down Expand Up @@ -874,8 +873,7 @@ p4A <- preprints %>%
scale_x_date(date_breaks = "1 month",
date_minor_breaks = "1 month",
date_labels = "%b") +
theme(axis.text.x = element_text(angle = 45, hjust = 1),
legend.position = "top") +
theme(legend.position = "top") +
ggsave("outputs/figures/partials/Figure_4A.png", width = 5, height = 4)
# Panel B: Journal locations of published papers (top 10)
Expand Down Expand Up @@ -1005,7 +1003,6 @@ p5A <- d %>%
scale_x_date(date_breaks = "1 month",
date_minor_breaks = "1 month",
date_labels = "%b") +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
ggsave("outputs/figures/partials/Figure_5A.png", width = 10, height = 4)
# PDF downloads
Expand All @@ -1025,7 +1022,6 @@ p5B <- d %>%
scale_x_date(date_breaks = "1 month",
date_minor_breaks = "1 month",
date_labels = "%b") +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
ggsave("outputs/figures/partials/Figure_5B.png", width = 10, height = 4)
# Patchwork
Expand All @@ -1039,7 +1035,59 @@ p5A + p5B + plot_layout(ncol = 1) +

```{r}
# Panel A: Abstract views (bioRxiv + medRxiv, non-COVID)
# Panel A: Abstract views in first month after posting
d <- preprint_usage %>%
mutate(
collection_month = str_sub(collection_date, 1, 3),
collection_year = str_c("20", str_sub(collection_date,
nchar(collection_date) - 1,
nchar(collection_date))),
collection_date = my(str_c(collection_month, collection_year))) %>%
inner_join(preprints, by = "doi") %>%
assign_covid_preprint() %>%
mutate(posted_month = floor_date(posted_date, unit = "month")) %>%
filter(posted_month >= analysis_start,
posted_month <= analysis_end,
posted_month == collection_date)
pS3A <- d %>%
ggplot(aes(x = posted_month, y = abstract_views, color = covid_preprint,
group = interaction(posted_month, covid_preprint))) +
geom_jitter(aes(fill = factor(covid_preprint)),
shape = 21, size = 0.25, alpha = 0.1,
position = position_jitterdodge(jitter.width = 15, dodge.width = 21)) +
geom_boxplot(width = 20, outlier.shape = NA, fill = NA,
position = position_dodge(width = 21)) +
labs(x = "Posted Month", y = "Abstract views in posting month",
fill = "", color = "") +
scale_y_log10(labels = scales::comma, limits = c(1, 1e6), expand = c(0, 0)) +
scale_color_manual(values = qualitative_hcl(2, palette = "Set2")) +
scale_fill_manual(values = qualitative_hcl(2, palette = "Set2")) +
scale_x_date(date_breaks = "1 month",
date_minor_breaks = "1 month",
date_labels = "%b") +
ggsave("outputs/figures/partials/Figure_S3A.png", width = 10, height = 4)
# Panel B: PDF downloads
pS3B <- d %>%
ggplot(aes(x = posted_month, y = pdf_downloads, color = covid_preprint,
group = interaction(posted_month, covid_preprint))) +
geom_jitter(aes(fill = factor(covid_preprint)),
shape = 21, size = 0.25, alpha = 0.1,
position = position_jitterdodge(jitter.width = 15, dodge.width = 21)) +
geom_boxplot(width = 20, outlier.shape = NA, fill = NA,
position = position_dodge(width = 21)) +
labs(x = "Posted Month", y = "PDF downloads in posting month",
fill = "", color = "") +
scale_y_log10(labels = scales::comma, limits = c(1, 1e6), expand = c(0, 0)) +
scale_color_manual(values = qualitative_hcl(2, palette = "Set2")) +
scale_fill_manual(values = qualitative_hcl(2, palette = "Set2")) +
scale_x_date(date_breaks = "1 month",
date_minor_breaks = "1 month",
date_labels = "%b") +
ggsave("outputs/figures/partials/Figure_S3B.png", width = 10, height = 4)
# Panel C: Abstract views (bioRxiv + medRxiv, non-COVID)
d <- preprint_usage %>%
inner_join(preprints, by = "doi") %>%
filter(covid_preprint != T) %>%
Expand All @@ -1052,7 +1100,7 @@ d <- preprint_usage %>%
filter(posted_date >= "2019-01-01",
posted_date <= analysis_end)
pS3A <- d %>%
pS3C <- d %>%
ggplot(aes(x = posted_month, y = abstract_views, group = posted_month)) +
geom_boxplot(outlier.shape = NA) +
geom_jitter(shape = 21, size = 0.2, alpha = 0.1) +
Expand All @@ -1066,11 +1114,10 @@ pS3A <- d %>%
date_labels = "%b-%y",
expand = c(0.01,0.01)) +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
ggsave("outputs/figures/partials/Figure_S3A.png", width = 10, height = 4)
# Panel B: PDF downloads (bioRxiv + medRxiv, non-COVID)
ggsave("outputs/figures/partials/Figure_S3C.png", width = 10, height = 4)
pS3B <- d %>%
# Panel D: PDF downloads (bioRxiv + medRxiv, non-COVID)
pS3D <- d %>%
ggplot(aes(x = posted_month, y = pdf_downloads, group = posted_month)) +
geom_boxplot(outlier.shape = NA) +
geom_jitter(shape = 21, size = 0.2, alpha = 0.1) +
Expand All @@ -1084,9 +1131,9 @@ pS3B <- d %>%
date_labels = "%b-%y",
expand = c(0.01,0.01)) +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
ggsave("outputs/figures/partials/Figure_S3B.png", width = 10, height = 4)
ggsave("outputs/figures/partials/Figure_S3D.png", width = 10, height = 4)
# Panel C: PDF downloads for additional preprint servers
# Panel E: PDF downloads for additional preprint servers
# Bind into one data frame
all_server_dloads <- bind_rows(preprint_usage %>%
inner_join(preprints, by = c("doi", "source")) %>%
Expand All @@ -1099,7 +1146,7 @@ all_server_dloads <- bind_rows(preprint_usage %>%
filter(posted_date >= analysis_start & posted_date <= analysis_end)
# Generate plot
pS3C <- all_server_dloads %>%
pS3E <- all_server_dloads %>%
assign_covid_preprint() %>%
ggplot(aes(x = source, y = pdf_downloads, color = covid_preprint)) +
geom_boxplot(outlier.shape = NA) +
Expand All @@ -1111,14 +1158,13 @@ pS3C <- all_server_dloads %>%
scale_y_log10(labels = scales::comma, limits = c(1, 1e7), expand = c(0, 0)) +
scale_color_manual(values = qualitative_hcl(2, palette = "Set2")) +
scale_fill_manual(values = qualitative_hcl(2, palette = "Set2")) +
theme(legend.position = "top") +
ggsave("outputs/figures/partials/Figure_S3C.png", width = 10, height = 4)
ggsave("outputs/figures/partials/Figure_S3E.png", width = 10, height = 4)
# Patchwork
pS3A + pS3B + pS3C +
plot_layout(nrow = 3) +
pS3A + pS3B + pS3C + pS3D + pS3E +
plot_layout(nrow = 5) +
plot_annotation(tag_levels = "A") +
ggsave("outputs/figures/Figure_S3.png", width = 10, height = 8)
ggsave("outputs/figures/Figure_S3.png", width = 10, height = 14)
```

Expand All @@ -1136,7 +1182,7 @@ d <- preprints %>%
week_start = 1)) %>%
assign_covid_preprint()
plot_main <- function(d, title_y) {
plot_main <- function(d, title_y, limit_y) {
d %>%
group_by(covid_preprint, posted_week) %>%
Expand All @@ -1146,7 +1192,7 @@ plot_main <- function(d, title_y) {
geom_line() +
geom_point(shape = 21) +
labs(x = "Date posted", y = title_y, fill = "", color = "") +
scale_y_continuous(labels = scales::percent, limits = c(0,1)) +
scale_y_continuous(labels = scales::percent, limits = c(0,limit_y)) +
scale_color_manual(values = qualitative_hcl(2, palette = "Set2")) +
scale_fill_manual(values = qualitative_hcl(2, palette = "Set2")) +
guides(fill = FALSE) +
Expand Down Expand Up @@ -1180,7 +1226,8 @@ plot_inset <- function(d, title_y) {
# Citations
p6A_main <- d %>%
mutate(is_cited = as.numeric(citations > 0)) %>%
plot_main(title_y = str_wrap("% of preprints with \u2265 1 citation", 30))
plot_main(title_y = str_wrap("% of preprints with \u2265 1 citation", 30),
limit_y = 1)
p6A_inset <- d %>%
mutate(metric = citations) %>%
plot_inset(title_y = "Citations")
Expand All @@ -1194,7 +1241,8 @@ p6A <- p6A_main +
# Twitter
p6B_main <- d %>%
mutate(is_cited = as.numeric(twitter > 1)) %>%
plot_main(title_y = str_wrap("% of preprints with \u2265 2 tweets*", 30))
plot_main(title_y = str_wrap("% of preprints with \u2265 2 tweets*", 30),
limit_y = 1)
p6B_inset <- d %>%
mutate(metric = twitter) %>%
plot_inset(title_y = "Tweets")
Expand All @@ -1208,7 +1256,8 @@ p6B <- p6B_main +
# News
p6C_main <- d %>%
mutate(is_cited = as.numeric(news > 0)) %>%
plot_main(title_y = str_wrap("% of preprints mentioned in \u2265 1 news article", 30))
plot_main(title_y = str_wrap("% of preprints mentioned in \u2265 1 news article", 30),
limit_y = 1)
p6C_inset <- d %>%
mutate(metric = news) %>%
plot_inset(title_y = "News")
Expand All @@ -1222,7 +1271,8 @@ p6C <- p6C_main +
# Blogs
p6D_main <- d %>%
mutate(is_cited = as.numeric(blogs > 0)) %>%
plot_main(title_y = str_wrap("% of preprints mentioned in \u2265 1 blog post", 30))
plot_main(title_y = str_wrap("% of preprints mentioned in \u2265 1 blog post", 30),
limit_y = 1)
p6D_inset <- d %>%
mutate(metric = blogs) %>%
plot_inset(title_y = "Blogs")
Expand All @@ -1236,21 +1286,23 @@ p6D <- p6D_main +
# Wikipedia
p6E_main <- d %>%
mutate(is_cited = as.numeric(wikipedia > 0)) %>%
plot_main(title_y = str_wrap("% of preprints with \u2265 1 Wikipedia citation", 30))
plot_main(title_y = str_wrap("% of preprints with \u2265 1 Wikipedia citation", 30),
limit_y = 0.1)
p6E_inset <- d %>%
mutate(metric = wikipedia) %>%
plot_inset("Wikipedia")
p6E <- p6E_main +
annotation_custom(ggplotGrob(p6E_inset),
xmin = as.Date("2020-06-01"),
xmax = as.Date("2020-11-07"),
ymin = 0.4, ymax = 1.04) +
ymin = 0.04, ymax = 0.104) +
ggsave("outputs/figures/partials/Figure_6E.png", width = 5, height = 4)
# Comments
p6F_main <- d %>%
mutate(is_cited = as.numeric(comments_count > 0)) %>%
plot_main(title_y = str_wrap("% of preprints with \u2265 1 comment", 30))
plot_main(title_y = str_wrap("% of preprints with \u2265 1 comment", 30),
limit_y = 1)
p6F_inset <- d %>%
mutate(metric = comments_count) %>%
plot_inset(title_y = "Comments")
Expand Down
Binary file modified outputs/figures/Figure_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/Figure_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/Figure_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/Figure_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/Figure_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/Figure_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/Figure_S1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/Figure_S2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/Figure_S3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/Figure_S4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/partials/Figure_1A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/partials/Figure_1B.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/partials/Figure_1C.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/partials/Figure_2A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/partials/Figure_2E.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/partials/Figure_2F.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/partials/Figure_3A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/partials/Figure_3B.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/partials/Figure_3C.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/partials/Figure_3D.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/partials/Figure_4A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/partials/Figure_4D.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/partials/Figure_5A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/partials/Figure_5B.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/partials/Figure_6A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified outputs/figures/partials/Figure_6B.png
Binary file modified outputs/figures/partials/Figure_6C.png
Binary file modified outputs/figures/partials/Figure_6D.png
Binary file modified outputs/figures/partials/Figure_6E.png
Binary file modified outputs/figures/partials/Figure_6F.png
Binary file modified outputs/figures/partials/Figure_6G.png
Binary file modified outputs/figures/partials/Figure_6H.png
Binary file modified outputs/figures/partials/Figure_6I.png
Binary file modified outputs/figures/partials/Figure_S1B.png
Binary file modified outputs/figures/partials/Figure_S2A.png
Binary file modified outputs/figures/partials/Figure_S3A.png
Binary file modified outputs/figures/partials/Figure_S3B.png
Binary file modified outputs/figures/partials/Figure_S3C.png
Binary file added outputs/figures/partials/Figure_S3D.png
Binary file added outputs/figures/partials/Figure_S3E.png
Binary file modified outputs/figures/partials/Figure_S4A.png
Binary file modified outputs/figures/partials/Figure_S4B.png

0 comments on commit e867a9f

Please sign in to comment.