geom_phylomorpho | R Documentation |
This behaves similar to phytools::phylomorphospace()
, but is for plotting a
2-D phylomorphospace with ggplot2::ggplot()
. This function works like any
other ggplot2
geom; it can be combined with other geoms (see the example
below), and the output can be modified using scales, themes, etc.
geom_phylomorpho(
tree,
mapping = NULL,
data = NULL,
position = "identity",
...,
seg_args = list(),
point_args = list(),
arrow = NULL,
arrow.fill = NULL,
lineend = "butt",
linejoin = "round",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
tree |
An object of class "phylo". |
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
position |
A position adjustment to use on the data for this layer. This
can be used in various ways, including to prevent overplotting and
improving the display. The
|
... |
Other arguments passed on to both |
seg_args |
A list of arguments passed only to |
point_args |
A list of arguments passed only to |
arrow |
specification for arrow heads, as created by |
arrow.fill |
fill colour to use for the arrow head (if closed). |
lineend |
Line end style (round, butt, square). |
linejoin |
Line join style (round, mitre, bevel). |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
The ancestral states are estimated using phytools::fastAnc()
. Note that
phytools
is not necessarily installed with deeptime
, but it is required
to use this function. Following the estimation of the ancestral states, the
nodes are connected using ggplot2::geom_segment()
, while the tips are
indicated using ggplot2::geom_point()
.
The default expectation is that the order of the data is the same order as
the tip labels of the tree (tree$tip.label
). However, if this is not the
case, you can map the optional label
aesthetic to a column in the data that
contains the tip names (see example below).
library(ggplot2)
library(ape)
tr <- rtree(10)
dat <- data.frame(
x = runif(10), y = runif(10), label = tr$tip.label,
row.names = tr$tip.label
)
ggplot(dat, aes(x = x, y = y, label = label)) +
geom_phylomorpho(tr) +
geom_label(size = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.