0

我在使用树状图绘制系统发育分析方面非常陌生,而且我被我的代码卡住了。到目前为止,我已经设法绘制了一个系统发育树。我在 pdf 中得到了一张漂亮的图片 在此处输入图像描述

使用下面的代码,但它没有标题、图例和映射信息。我想做的是将映射文件添加到绘图上,使其看起来像这样在此处输入图像描述。映射文件是一个 excel 文件,具有三列(有机体名称、其门和序列本身)在此处输入图像描述。我想要完成的是使用门列(同时保持有机体名称不变)对图进行颜色编码的叶子的尖端,有一个图例和一个标题。谢谢你的帮助。

library(dendextend)

library(circlize)

library(factoextra)

pdf("IP6K_tree_factoextra_fan.pdf", width = 55, height = 60)
fviz_dend(
  dend1,
  k = 10,
  h = NULL,
  k_colors = c("blue", "green3", "maroon", "magenta", "purple", "red", "orange", "brown", "black", "#00AFBB"),
  palette = NULL,
  show_labels = TRUE,
  color_labels_by_k = TRUE,
  label_cols = NULL,
  labels_track_height = NULL,
  repel = FALSE,
  lwd = 3,
  type = "circular",
  phylo_layout = "layout.auto",
  rect = TRUE,
  rect_border = "gray",
  rect_lty = 2,
  rect_fill = TRUE,
  horiz = FALSE,
  cex = 2,
  main = "IP6K Kinase in Eukaryotic organisms",
  ggtheme = theme_classic()
)
dev.off()

leaves.colours <- c("#A73030", "#CD534CFF", "#DF536B", "#CD0BBC","#0073C2FF","#003C67FF",
                 "#7AA6DCFF", "#4A6990FF", "#2297E6", "#0073C299", "#7AA6DC99", 
                  "#003C6799", "#28E2ES", "#4A699099", "#F5C710", "#8F7700FF", 
                  "#EFC00099", "#61D04F", "steelblue", "black")

leaves.nodes <- c("Chordata", "Arthropoda", "Ascomycota", "Basidiomycota", "Mollusca", 
                "Euglenozoa", "Oomycota", "Microsporidia", "Cnidaria", "Amoebozoa", 
                "Echinodermata", "Metamonada", "Apicomplexa", "Rhodophyta", 
                "Chlorophyta", "Platyhelminthes", "Nematoda", "Tracheophytes", 
                "Zygomycota", "Mucoromycota")
```

  [1]: https://i.stack.imgur.com/2Zz2w.jpg
  [2]: https://i.stack.imgur.com/6sCxt.png
  [3]: https://i.stack.imgur.com/Ya2BC.jpg
4

0 回答 0