简体   繁体   中英

How to produce a similar plot? [R]

The authors of this paper ( https://www.sciencedirect.com/science/article/pii/S0092867415006418 ) mention in their supplementary file that these were produced in Matlab. Due to lack of proficiency, time to learn it, and the license, I was trying to replicate the figure below (Figure 2 of the paper, specifically figure 2A on the left ) in R: 在此处输入图像描述

Any suggestions? What is this plot called more generally?

Thank you!

To me it looks like a classic point plot: You can reproduce this kind of plot in R with ggplot:

# Fake dataframe with xy coordinates, type of data (for the coloring), pvalue (for size), and different panel
df <- data.frame(
  x = rep(1:20, 10),
  y = rnorm(200, mean = 0, sd = 2),
  type = rep(rep(LETTERS[1:5], each = 4), 10),
  pvalue = sample(0:50, size = 200, replace = T)/1000,
  panel = sample(rep(paste0("panel", 1:4), each = 50)), 200, replace = F)


# plot
library(ggplot2)
ggplot(df, aes(x, y*x , color = type, size = pvalue)) + geom_hline(yintercept = 0) + geom_point() + facet_wrap(~panel, ncol = 2)

ggsave("demo.png")

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM