p %>% insert_left(phr,width = .3) %>% insert_right(pp,width = .3) %>% insert_right(g,width = .4) %>% insert_top(pc,height =.1) %>% insert_top(phc,height = .2) 看图确实让人感觉眼花缭乱的,但逻辑比较清晰,就是先用ggplot2绘制所有图,然后通过aplot将这些图放在主图的周围。 3...
insert_top(group, height = .05)%>% insert_left(Pathway, width = .05)%>% insert_left(phr,width=.2) 最后,我们还可以对特定的区域进行划线,框选等等操作。 p2 <- p1+geom_raster()+scale_fill_gradient2(low="#003366", high="#990033", mid="white")+ geom_tile()+theme_minimal()+ theme...
insert_left(p2,width = 0.2)%>% insert_top(p3,height = 0.2) 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 这里多了一个知识点是ggtree作图默认开口树的方向是向右,如果需要把开口改成向下,需要加上layout_dendrogram()函数 最终的结果如下 image.png 这里和论文中的图有些不一...
aplot::insert_* 这个函数族包括aplot::insert_bottom()、aplot::insert_left()、aplot::insert_right()、aplot::insert_top()。我通常用于单张复杂图的绘制。但缺点是返回的对象不是ggplot对象,进行后续操作会比较麻烦。 p1 %>% insert_top(p2,height = 0.2) %>% insert_right(p3,0.2) 参考 https:/...
insert_left(p2,width = 0.2)%>% insert_top(p3,height = 0.2) 这里多了一个知识点是ggtree作图默认开口树的方向是向右,如果需要把开口改成向下,需要加上layout_dendrogram()函数 最终的结果如下 这里和论文中的图有些不一致,可能是聚类算法的原因;ggtree有一个默认的从上到下排序,比如左侧的树现在第一个是...
insert_left(p2,width = 0.05) image.png 这里遇到一个问题是如何将右侧的图例放大左上角去?用代码如何实现我暂时还不知道,出图以后手动编辑吧! 接下来是模仿文章开头,拼接三个热图 p3<-p1+ theme(axis.text.y = element_blank()) pdf(file = "123.pdf",width = 12) ...
insert_left(ggtree_plot, width=.2) %>% insert_top(labels, height=.02) %>% insert_top(ggtree_plot_col, height=.1) aplot版本热图 aplot具有强大的组图功能。这里我们修改一下Y叔教程的代码,就可以完成这个热图的绘制。 g3_2 = ggplot(pcm, ae...
p5<- p1%>%insert_left(p3,width = 0.4) p5 但是,尝试将p2(分面后)的堆叠柱形图和聚类树进行拼合,聚类树会识别出错,如下图: p55<- p2%>%insert_left(p3,width = 0.4) p55 这样显然是不对的,那么假如想要保留分面效果,还能怎么做?下面分享另一种可以保留分面的方法: ...
ticks = element_blank(), axis.text.x = element_text(angle=90,hjust=1,vjust=0.5))+ #scale_x_discrete(expand = c(0,0))+ scale_y_discrete(expand = c(0,0))+ scale_fill_manual(name="class", values = c("#619cff","#00ba38","#f8766d"))library(aplot)p1%>% insert_left(p2...
+scale_fill_manual(values =c("green","blue","red"))p1%>%insert_left(p2,width =0.05) AI代码助手复制代码 image.png 这里遇到一个问题是如何将右侧的图例放大左上角去?用代码如何实现我暂时还不知道,出图以后手动编辑吧! 接下来是模仿文章开头,拼接三个热图...