Galeaspid anatomy and the origin of vertebrate paired appendages
https://www.nature.com/articles/s41586-022-04897-6
s41586-022-04897-6.pdf
最近朋友圈好多人都在转发这篇论文,我也找来看了看,论文整体的内容我看起来还是非常吃力的,但是论文中关于进化树的作图方法我可以写个教程分享给大家
今天推文的内容重复一下论文中的Fig4a 进化树叠加图片并在节点上叠加饼状图
image.png
library(ggtree)
library(scatterpie)
tree<-read.tree("data/20220930/fig4a.nwk")
ggtree(tree)+
geom_tiplab()+
xlim(NA,15)
image.png
ggtree(tree)+
geom_tiplab(aes(image=paste0("data/20220930/",label,".png")),
geom = "image",size=0.2,offset = 0.2)+
xlim(NA,16)+
geom_tiplab(offset = 4)
image.png
ggtree(tree)+
geom_nodelab(aes(label=node))+
geom_tiplab(aes(label=node)) -> p
library(tidyverse)
list(ggplot2::ggplot_build(p)$data[[3]],
ggplot2::ggplot_build(p)$data[[4]])%>%
bind_rows() %>%
select(y,x,node) %>%
arrange(node) %>%
write_csv("data/20220930/pie_df1.csv")
pie.df<-read_csv("data/20220930/pie_df1.csv")
pie.df
ggtree(tree,size=1)+
#geom_tiplab(offset=2)+
geom_scatterpie(data=pie.df,
aes(x=x,y=y,group=node,
r=0.4),
cols = c("Absent","Present"))+
scale_fill_manual(values = c("Absent"="white",
"Present"="#55cc81"))+
geom_tiplab(aes(image=paste0("data/20220930/",label,".png")),
geom = "image",size=0.2,offset = 0.4)+
xlim(NA,16)+
geom_tiplab(offset = 4)+
theme(legend.position = c(0.2,0.8))+
coord_fixed()
image.png
这里如何旋转每个饼状图暂时想不明白了
ggtree里有一个nodepie的函数也可以试试添加饼状图
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有