大家好,元旦过得还好吗?之前我们聊过如果富集分析结果不理想,如何选择富集分析的terms,如果不记得,可以看看这三个推文和视频。
今天我们聊聊富集分析的图如何美化
ggplot(xx.all %>%
dplyr::filter(stringr::str_detect(pattern = "apopto",Description)) %>%
# dplyr::mutate(Description = factor(Description, levels = unique(.$Description))) %>%
dplyr::filter(stringr::str_detect(negate = TRUE,pattern = "regulation of lymphocyte apop",Description) ) %>%
group_by(Description) %>%
add_count() %>%
dplyr::arrange(dplyr::desc(n),dplyr::desc(Description)) %>%
mutate(Description =forcats:: fct_inorder(Description))
, #fibri|matrix|colla
aes(Cluster, Description)) +
geom_point(aes(fill=p.adjust, size=Count), shape=21)+
theme_bw()+
theme(axis.text.x=element_text(angle=90,hjust = 1,vjust=0.5),
axis.text.y=element_text(size = 12),
axis.text = element_text(color = 'black', size = 12)
)+
scale_fill_gradient(low="red",high="blue")+
labs(x=NULL,y=NULL)
# coord_flip()
有人说这图不好看,有点乱。那我稍微更改一下,富集分析的结果会更好看点。主要是Description列变成因子就行啦,这样看上去确实清爽很多:
?
ggplot(xx.all %>%
dplyr::filter(stringr::str_detect(pattern = "apopto",Description)) %>%
dplyr::mutate(Description = factor(Description, levels = unique(.$Description))) %>%
dplyr::filter(stringr::str_detect(negate = TRUE,pattern = "regulation of lymphocyte apop",Description) ) %>%
group_by(Description) %>%
add_count() %>%
dplyr::arrange(dplyr::desc(n),dplyr::desc(Description)) %>%
mutate(Description =forcats:: fct_inorder(Description))
, #fibri|matrix|colla
aes(Cluster, Description)) +
geom_point(aes(fill=p.adjust, size=Count), shape=21)+
theme_bw()+
theme(axis.text.x=element_text(angle=90,hjust = 1,vjust=0.5),
axis.text.y=element_text(size = 12),
axis.text = element_text(color = 'black', size = 12)
)+
scale_fill_gradient(low="red",high="blue")+
labs(x=NULL,y=NULL)
# coord_flip()