旋转用R plotly plotU dendro绘制的树状图

旋转用R plotly plotU dendro绘制的树状图,r,plotly,dendrogram,R,Plotly,Dendrogram,我有这个物种apephylo树对象: species.phylo <- ape::read.tree(text="(Platypus:0.13,((((Koala:0.06,Wallaby:0.06):0.013,Tasmanaian_devil:0.067):0.002,Opposum:0.07):0.042,((Armadillo:0.078,Sloth:0.078):0.028,(((Rabbit:0.1,(((Guinea_pig:0.07,Chinchilla:0.07):0.0

我有这个物种
ape
phylo
树对象:

species.phylo <- ape::read.tree(text="(Platypus:0.13,((((Koala:0.06,Wallaby:0.06):0.013,Tasmanaian_devil:0.067):0.002,Opposum:0.07):0.042,((Armadillo:0.078,Sloth:0.078):0.028,(((Rabbit:0.1,(((Guinea_pig:0.07,Chinchilla:0.07):0.005,(Naked_mole-rat:0.06,Damarland_mole-rat:0.058):0.02):0.03,(Jerboa:0.09,(Blind_mole-rat:0.09,((((Chinese_hamster:0.05,Golden_hamster:0.05):0.016,Deer_mouse:0.064):0.003,Prairie_vole:0.07):0.01,(Rat:0.063,Mouse:0.061):0.017):0.012):0.01):0.007):0.004):0.001,(Mouse_lemur:0.08,(Tarsier:0.08,((Marmoset:0.03,Mas_night_monkey:0.025):0.023,((((((Bonobo:0.003,Chimpanzee:0.002):0.0043,Human:0.0067):0.002,Gorilla:0.0086):0.0085,Orangutan:0.017):0.0027,Gibbon:0.02):0.011,(Green_monkey:0.012,((Sooty_mangabey:0.006,Baboon:0.0067):0.001,(Macaque:0.003,Pig-tailed_macaque:0.004):0.004):0.004):0.02):0.02):0.03):0.0006):0.02):0.0001,((European_hedgehog:0.1,Common_shrew:0.11):0.00098,(Little_brown_bat:0.09,((Cat:0.065,(Dingo:0.001,Dog:0.001):0.06):0.015,((Dolphin:0.069,(Pig:0.077,((Goat:0.01,Sheep:0.01):0.017,Cow:0.027):0.05):0.0001):0.01,(Horse:0.006,Donkey:0.0067):0.076):0.004):0.0017):0.015):0.0001):0.0001):0.014):0.006);")
然后使用
R
plotly
进行绘图:

library(plotly)
plot_dendro(species.dend, height = 600, width=600) %>% 
  hide_legend() %>% 
  highlight(persistent = F, dynamic = F)
它的根指向右边,叶子指向左边,并且被压扁了:

因此,我的问题是:

  • 如何将其旋转180度,使根部指向左侧,使叶指向右侧
  • 如何伸展树枝,使其不致被压扁

  • 您尝试过ggtree()吗?Plotly使用Dendestend进行树状图操作。您可能希望从DendExtrend查看ggdend,看看这是否解决了您的问题(因为您可以在输出上使用ggplotly):
    library(plotly)
    plot_dendro(species.dend, height = 600, width=600) %>% 
      hide_legend() %>% 
      highlight(persistent = F, dynamic = F)