簡體   English   中英

如何生產類似的plot? [R]

[英]How to produce a similar plot? [R]

本文的作者 ( https://www.sciencedirect.com/science/article/pii/S0092867415006418 ) 在他們的補充文件中提到這些是在 Matlab 中產生的。 由於缺乏熟練度、學習時間和許可證,我試圖在 R 中復制下圖(論文的圖 2,特別是左側的圖 2A ): 在此處輸入圖像描述

有什么建議么? 這個 plot 一般叫什么?

謝謝!

對我來說,它看起來像一個經典點 plot:您可以使用 ggplot 在 R 中重現這種 plot:

# 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")

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM