bubble_cover
写在前面
【这图怎么画】系列的图都来自VIP群
里同学的提问。推文只是对图片的复现,不代表作者对图片展现形式的认同。欢迎同学们在群里分析有意思的图片。
本期图片
image-20221230233154825image-20221230233532195
❝Han G, Yang G, Hao D, et al. 9p21 loss confers a cold tumor immune microenvironment and primary resistance to immune checkpoint therapy. Nat Commun. 2021;12(1):5606. Published 2021 Sep 23. doi:10.1038/s41467-021-25894-9
❞
分析了不同癌症类型中,9p21-WT
肿瘤与9p21-loss
肿瘤中28种免疫调节基因表达的变化。
复现结果
data+code
绘图
# data example library(dplyr) data <- data.frame(type =sort(rep(paste0('cancer',LETTERS[seq(1,15)]),15)), gene = rep(paste0('gene',1:15),15), Log2FC = runif(225,-1,1), pvalue = runif(225,0.000001,1)) head(data) ## plot library(ggplot2) p1 <- ggplot(data,aes(x=type ,y= gene)) + geom_point(aes(size=-log10(pvalue), fill=Log2FC), shape=21, color="black") + scale_fill_gradient2(name = 'Log2FC\n(Expression)', limit = c(-1.001,1.001), breaks = c(-1.0,-0.5,0.0,0.5,1.0), low='#444283', high='#943934', mid="white", midpoint = 0)+ scale_size_continuous(name = '-Log10 qvalue', limit = c(-0.001,3.1), breaks = c(0,1,2,3))+ geom_hline(yintercept=c(5.5, 10.5))+ labs(x=NULL, y=NULL, title = "Expression of immunomodulatory genes (9p21-Loss vs 9p21-WT)")+ theme_bw()+ theme(panel.grid = element_blank(), legend.key = element_blank(), plot.title = element_text(hjust = 0.5, size = 12), axis.text =element_text(size = 10, color = "black"), axis.text.y = element_blank(), axis.text.x=element_text(angle=45,hjust = 0.5,vjust=0.5)) p1 # rect anotate anotate <- data %>% distinct(gene,.keep_all = T) head(anotate) p2 <- ggplot(anotate,aes(x = 0,y = gene,label= gene )) + geom_text()+ annotate("rect", ymin = c(0.5,5.5,10.5), ymax = c(5.5,10.5,15.5), xmin = -5, xmax = 0.7, fill = c('#ecf7fb','#fffbe7','#ffe7df'), alpha = 0.5)+ theme_void() p2 # patch library(patchwork) library(cowplot) p2+p1+plot_layout(nrow= 1, width = c(1, 2)) ggsave('bubble_heatmep.pdf',width = 10,height = 5)
result
❝后续在AI里稍微调整一下即可~
❞
往期内容
- CNS图表复现|生信分析|R绘图 资源分享&讨论群!
- 这图怎么画| 有点复杂的散点图
- 这图怎么画 | 相关分析棒棒糖图
- 组学生信| Front Immunol |基于血清蛋白质组早期诊断标志筛选的简单套路
- (免费教程+代码领取)|跟着Cell学作图系列合集
- Q&A | 如何在论文中画出漂亮的插图?
- 跟着 Cell 学作图 | 桑葚图(ggalluvial)
- R实战 | Lasso回归模型建立及变量筛选
- 跟着 NC 学作图 | 互作网络图进阶(蛋白+富集通路)(Cytoscape)
- R实战 | 给聚类加个圈圈(ggunchull)
- R实战 | NGS数据时间序列分析(maSigPro)
- 跟着 Cell 学作图 | 韦恩图(ggVennDiagram)