I am using the ape
package in R to generate phylogenetic trees. I would like to print out the generated tree in a png format so I can pipe the image to a website. I cannot seem to find the commands to print out the generated tree (if this is possible). Some advice/insight would be appreciated.
It sounds like you're looking for the plot method for trees (objects of class "phylo"), e.g.:
library(ape)
tt <- rcoal(10)
png("phylo1.png")
plot(tt)
dev.off()
?plot.phylo
gives information on the many, many options you have for customizing the plot.
There are more options for plotting, e.g. from the vignette for the phylogram package:
Publication-quality trees can be generated from dendrogram objects using the stats plotting function plot.dendrogram, and the extensive plotting functions available in a dendrogram-enhancing packages such as circlize (Z. Gu et al. 2014) and dendextend (Galili 2015). The latter also offers the facility to convert dendrograms to “ggdend” objects, for which many powerful ‘grammar of graphics’ plotting functions are available in the ggplot2 (Wickham 2009) and ggdendro (DeVries and Ripley 2016) packages. Moreover, there are several advanced plotting options for “phylo” objects in the ape package (E. Paradis, Claude, and Strimmer 2004), made accessible for dendrogram objects here via the Newick import/export functions read.dendrogram and write.dendrogram ...