Created
February 17, 2015 21:28
-
-
Save zkamvar/5b60cccc117276604648 to your computer and use it in GitHub Desktop.
plot_phylo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Two functions to plot phylo objects from ape. | |
# | |
# Both of these functions plot their respective trees. The ... gives the user | |
# the ability to adjust things like color or font size. | |
# | |
nj_plot_phylo <- function(tree, ...){ | |
barlen <- min(median(tree$edge.length), 0.1) | |
if (barlen < 0.1) barlen <- 0.01 | |
tree <- ladderize(tree) | |
plot.phylo(tree, font = 2, adj = 0, xpd = TRUE, | |
label.offset = 0.0125, ...) | |
nodelabels(tree$node.label, adj = c(1.3, -0.5), frame = "n", cex = 0.8, | |
font = 3, xpd = TRUE) | |
add.scale.bar(lwd = 5, length = barlen) | |
} | |
upgma_plot_phylo <- function(tree, ...){ | |
barlen <- min(median(tree$edge.length), 0.1) | |
if (barlen < 0.1) barlen <- 0.01 | |
plot.phylo(tree, font = 2, adj = 0, xpd = TRUE, | |
label.offset = 0.0125, ...) | |
nodelabels(tree$node.label, adj = c(1.3, -0.5), frame = "n", cex = 0.8, | |
font = 3, xpd = TRUE) | |
axisPhylo(3) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
usage: