今天来画类似《Nature》上论文[1] 中的Figure1b,为下图中的b:Fig1b [1]首先载入R包:library(ggplot2) # 需提前安装install.packages("ggplot2")第二步,创建作图用的数据:set.seed(1) data types = c(rep("BA.1", 111), rep("BA.2", 195), rep("Alpha", 18), rep("Delta", 117)), groups = c(rep("Persistent infection", 97), rep("Reinfection", 14), rep("Persistent infection", 167), rep("Reinfection", 28), rep("Persistent infection", 11), rep("Reinfection", 7), rep("Persistent infection", 106), rep("Reinfection", 11)), days = c(sample(26:180, 97, replace = T), # BA.1 sample(26:75, 14, replace = T), sample(26:140, 167, replace = T), # BA.2 sample(30:125, 27, replace = T), 200, sample(26:190, 11, replace = T), # Alpha sample(26:165, 7, replace = T),
………………………………