library(ggplot2) ## import data: heatmbenefit, heatmconcern, heatmway levelx <- c("PS&E","L&HS","SS&H") levely <- c("Other","China","Europe","US") ============== ##Fig.8: Benefit levelb <-c("B9","B1","B8","B3","B6","B2","B4","B7","B5") heatmbenefit$B <- factor(heatmbenefit$B, levelb) heatmbenefit$Field <- factor(heatmbenefit$Field, levelx) heatmbenefit$Country <- factor(heatmbenefit$Country, levely) labelb <- c(B1="Accelerating research communication", B2="Early feedback", B3="Additional exposure", B4="More citations", B5="Showing progress for grants/jobs", B6="Establishing priority", B7="Sharing results that don't fit in journals", B8="Free to post", B9="Free to read") ## plot ggplot(heatmbenefit, aes(x=Field, y=Country,fill=value))+ ggtitle(NULL)+geom_tile(color="black")+scale_fill_gradient2( low = "darkgreen", mid = "lightgoldenrod2", high = "red", midpoint = 0.289 )+geom_text(aes(label =scales::percent(value,accuracy = 1)),color = "black",size = 3) +facet_wrap(B~., ncol=3, labeller=labeller(B=labelb, size=15)) +theme_minimal()+xlab(NULL)+ylab(NULL)+theme(plot.title = element_text(size = 12, hjust = 0.5, vjust = 0.5, angle = 0),legend.position = "None")+theme(text=element_text(size=12)) ================= ## Fig.9: Concern levelc <-c("C2","C1","C3","C11","C10","C8","C4","C9","C7","C6","C5") heatmconcern$C <- factor(heatmconcern$C, levelc) heatmconcern$Field <- factor(heatmconcern$Field, levelx) heatmconcern$Country <- factor(heatmconcern$Country, levely) labelc <- c(C1="Sharing before peer review", C2="Low reliability/credibility", C3="Premature media coverage", C4="Undermining peer-reviewed journals", C5="Harmful comments on preprints", C6="Information overload", C7="Lack of recognition for preprints", C8="Getting scooped by others", C9="Using preprints to scoop others", C10="Incompatibility with journal policies", C11="Copyright/licensing uncertainty") ## plot ggplot(heatmconcern, aes(x=Field, y=Country,fill=value))+ ggtitle(NULL)+geom_tile(color="black")+scale_fill_gradient2( low = "darkgreen", mid = "lightgoldenrod2", high = "red", midpoint = 0.192 )+geom_text(aes(label=scales::percent(value,accuracy = 1)),color = "black",size = 3) +facet_wrap(C~., ncol=3, labeller=labeller(C=labelc)) +theme_minimal()+xlab(NULL)+ylab(NULL)+theme(plot.title = element_text(size = 12, hjust = 0.5, vjust = 0.5, angle = 0),legend.position = "None") ================= ## Fig.10: Way levelw <-c("W2","W4","W5","W7","W6","W3","W1") heatmway$W <- factor(heatmway$W, levelw) heatmway$Field <- factor(heatmway$Field, levelx) heatmway$Country <- factor(heatmway$Country, levely) labelw <- c(W1="Making preprinting easier", W2="Integration in journal workflows", W3="Training", W4="Recognition for preprints", W5="Funders encouraging/mandating preprinting", W6="Institutions encouraging/mandating preprinting", W7="Journals encouraging/mandating preprinting") ## plot ggplot(heatmway, aes(x=Field, y=Country,fill=value))+ ggtitle(NULL)+geom_tile(color="black")+scale_fill_gradient2( low = "darkgreen", mid = "lightgoldenrod2", high = "red", midpoint = 0.238 )+geom_text(aes(label=scales::percent(value,accuracy = 1)),color = "black",size = 3) +facet_wrap(W~., ncol=3, labeller=labeller(W=labelw)) +theme_minimal()+xlab(NULL)+ylab(NULL)+theme(plot.title = element_text(size = 12, hjust = 0.5, vjust = 0.5, angle = 0),legend.position = "None")