plot.phyloLayout | R Documentation |
Generic plot function for phylogenetic trees with layouts generated using ggfree. The coordinate system of the plot depends on the layout algorithm:
Rectangular/slanted layout: The x-axis is scaled to the height of the tree (from the root to the furthest tip). The y-axis is scaled to the number of tips (1:Ntip(phy)).
Circular (radial) layout: Graphical parameters such as 'col' or 'lwd' can take either a single value or a vector to specify custom values for each edge. The ordering should be the same as the original tree (phylo) object, which defaults to preorder traversal.
## S3 method for class 'phyloLayout'
plot(
obj,
type = "l",
col = "grey50",
lwd = 2,
label = "t",
cex.lab = 0.8,
mar = NA,
xlim = NA,
add = FALSE,
offset = 0,
...
)
obj: |
S3 object of class 'phyloLayout' |
type: |
if 'n', then line segments are not drawn |
col: |
colour for line segments. Defaults to 'grey50'. |
lwd: |
stroke width for line segments. Defaults to 2. |
label: |
Specifies whether nodes are labeled with text.
|
cex.lab: |
Character expansion factor for node labels (default 0.8). |
mar: |
(optional) vector of margin widths (graphical parameter). |
...: |
additional graphical parameters to pass to 'lines' and 'label' |
# generate random coalescent tree
set.seed(1999); phy <- rcoal(50)
# rectangular tree
plot(tree.layout(phy, type='r'), mar=c(3,0,0,1))
axis(side=1)
# unscaled slanted tree with colors
pal <- colorRampPalette(c('cadetblue', 'brown'))
plot(tree.layout(phy, type='s', unscaled=TRUE), col=pal(5))
# unrooted tree
plot(tree.layout(phy, type='u'))
# circular (radial) tree
plot(tree.layout(phy, type='o'), label='t')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.