杨志远
[转载]ggtree美化进化树
2023-6-13 11:18
阅读:1292
dir() # 查看工作目录[1] "example_corynebacteria.tree.nwk"       
[2] "example_corynebacteria.tree.reroot.xml"

library(ggplot2) # 加载ggplot2
library(ggtree) # 加载
ggtreetree=read.tree("example_corynebacteria.tree.nwk") # 读取nwk文件
data=fortify(tree)

tregraph=ggtree(tree, layout="rectangular", size=0.8, col="deepskyblue3") +
  # 树体:树文件、树形、粗细、颜色
  geom_tiplab(size=3, color="purple4", hjust=-0.05) +
  # 枝名:大小、颜色、高度
  geom_tippoint(size=1.5, color="deepskyblue3") +
  # 端点:大小、颜色
  geom_nodepoint(color="orange", alpha=1/4, size=2) +
  # 末节点:颜色、透明度、大小
  theme_tree2() +
  # x轴标尺
  xlim(NA, max(data$x)*1.3)
  # x轴宽度
  
 
  pdf("tregraph.pdf")
  tregraph
   dev.off()

转自   https://www.jianshu.com/p/c77fcd4f4111

转载本文请联系原作者获取授权,同时请注明本文来自杨志远科学网博客。

链接地址:https://wap.sciencenet.cn/blog-3434047-1391610.html?mobile=1

收藏

分享到:

当前推荐数:0
推荐到博客首页
网友评论0 条评论
确定删除指定的回复吗?
确定删除本博文吗?