# create a random tree:
tre <- rtree(25)
# visualize labels of internal nodes:
plot.phylo(tre, use.edge.length=FALSE)
nodelabels()
# rotate clades around node 30:
tre.new <- rotate(tre, 30)
# compare the results:
X11() # open new graphical device
par(mfrow=c(1,2)) # devide graphical device
plot(tre) # plot old tre
plot(tre.new) # plot new tree
# visualize labels of terminal nodes:
X11() # open new graphical device
plot.phylo(tre)
tiplabels()
# rotate clades containing nodes 12 and 20:
tre.new <- rotate(tre, c(12, 21))
# compare the results:
X11() # open new graphical device
par(mfrow=c(1,2)) # devide graphical device
plot(tre) # plot old tre
plot(tre.new) # plot new tree
# or you migth just specify tiplabel names:
tre.new <- rotate(tre, c("t3", "t14"))
# compare the results:
X11() # open new graphical device
par(mfrow=c(1,2)) # devide graphical device
plot(tre) # plot old tre
plot(tre.new) # plot new tree
Run the code above in your browser using DataLab