写在前面
【这图怎么画】系列的图都来自VIP群
里同学的提问。推文只是对图片的复现,不代表作者对图片展现形式的认同。欢迎同学们在群里分析有意思的图片。
本期图片
![0d7e7ea693b0cc9b56c51c236e471ebc.png](https://i-blog.csdnimg.cn/blog_migrate/d19bcbf3951adc704ea16caf4fab0857.png)
![98a3a04aad4ac9d1c9cdc9dc02ddb1c8.png](https://i-blog.csdnimg.cn/blog_migrate/d9c8164dda31538fda00919b618ba178.png)
❝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种免疫调节基因表达的变化。
复现结果
![22ee5dbff2ac69f23714ef305ef5605c.png](https://i-blog.csdnimg.cn/blog_migrate/ae747bbee162e3eca838b32a103eee50.png)
示例数据和代码领取
点赞
、在看
本文,分享至朋友圈集赞30个
并保留30分钟
,截图发至微信mzbj0002
领取。
木舟笔记永久VIP企划
「权益:」
木舟笔记所有推文示例数据及代码(「在VIP群里」实时更新)。
data+code 木舟笔记「科研交流群」。
「收费:」
「169¥/人」。可添加微信:mzbj0002
转账,或直接在文末打赏。木舟笔记「2022VIP」可直接支付「70¥」升级。
![18821d7fa57546a1f0feea3651c6fe7a.png](https://i-blog.csdnimg.cn/blog_migrate/a7a4fa7892e6308ce62b2d198da7a19d.png)
绘图
# 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)
![f406c1b72f1b66c3f88cb562f1509f15.png](https://i-blog.csdnimg.cn/blog_migrate/d614808891d2ba93657d57fe119ea028.png)
❝后续在AI里稍微调整一下即可~
❞
往期内容
![af04e43a560acc0a0cf583fa862030e0.png](https://i-blog.csdnimg.cn/blog_migrate/7c4e98159d3df04b59d148db30a994df.png)