phyloseq-package
is to make the determination of these features/settings as easy as possible.plot_tree(physeq, method = "sampledodge", nodelabf = NULL, color = NULL,
shape = NULL, size = NULL, min.abundance = Inf, label.tips = NULL,
text.size = NULL, sizebase = 5, base.spacing = 0.02,
ladderize = FALSE, plot.margin = 0.2, title = NULL, treetheme = NULL,
justify = "jagged")
phyloseq-class
, containing at
minimum a phylogenetic tree component (try phy_tree
).
One of the major advantages of this function over basic tree-plotting utilities
in the ape
-package is the ability to easily annotate the tree
with sample variables and taxonomic information. For these uses,
the physeq
argument should also have a sample_data
and/or tax_table
component(s)."sampledodge"
.
The name of the annotation method to use.
This will be expanded in future versions.
Currently only "sampledodge"
and "treeonly"
are supported.
The "sampledodge"
option results in points
drawn next to leaves if individuals from that taxa were observed,
and a separate point is drawn for each sample.NULL
.
If NULL
, the default, a function will be selected for you based upon
whether or not there are node labels in phy_tree(physeq)
.
For convenience, the phyloseq package includes two generator functions
for adding arbitrary node labels (can be any character string),
nodeplotdefault
;
as well as for adding bootstrap values in a certain range,
nodeplotboot
.
To not have any node labels in the graphic, set this argument to
nodeplotblank
.NULL
.
The name of the variable in physeq
to map to point color.
Supported options here also include the reserved special variables
of psmelt
.NULL
.
The name of the variable in physeq
to map to point shape.
Supported options here also include the reserved special variables
of psmelt
.NULL
.
The name of the variable in physeq
to map to point size.
A special argument "abundance"
is reserved here and scales
point size using abundance in each sample on a log scale.
Supported options here also include the reserved special variables
of psmelt
.Inf
,
meaning that no points will have their abundance labeled.
If a vector, only the first element is used.NULL
,
indicating that no tip labels will be printed.
If "taxa_names"
, then the name of the taxa will be added
to the tree; either next to the leaves, or next to
the set of points that label the leaves. Alternatively,
if this is one of the rank names (from rank_names(physeq)
),
then the identity (if any) for that particular taxonomic rank
is printed instead.NULL
. If left NULL
, this function
will automatically calculate a (hopefully) optimal text size
given the vertical constraints posed by the tree itself.
This argument is included in case the
automatically-calculated size is wrong, and you want to change it.
Note that this parameter is only meaningful if label.tips
is not NULL
.0.02
.
Should be positive.
This defines the base-spacing between points at each tip/leaf in the
the tree. The larger this value, the larger the spacing between points.
This is useful if you have problems with overlapping large points
and/or text indicating abundance, for example. Similarly, if you
don't have this problem and want tighter point-spacing, you can
shrink this value.FALSE
, TRUE
, or "left"
).
Default is FALSE
.
This parameter specifies whether or not to ladderize
the tree
(i.e., reorder nodes according to the depth of their enclosed
subtrees) prior to plotting.
This tends to make trees more aesthetically pleasing and legible in
a graphical display.
When TRUE
or "right"
, ``right'' ladderization is used.
When set to FALSE
, no ladderization is applied.
When set to "left"
, the reverse direction
(``left'' ladderization) is applied.
This argument is passed on to tree_layout
.0.2
.
Should be positive.
This defines how much right-hand padding to add to the tree plot,
which can be required to not truncate tip labels. The margin value
is specified as a fraction of the overall tree width which is added
to the right side of the plot area. So a value of 0.2
adds
twenty percent extra space to the right-hand side of the plot.NULL
. Character string.
The main title for the graphic."jagged"
, the default, results in
these tip-mapped elements being spaced as close to the tips as possible
without gaps.
Currently, any other value for justify
results in
a left-justified arrangement of both labels and points.ggplot
2 plot.plot_tree
has since been re-written.
For details see tree_layout
.plot.phylo
There are many useful examples of phyloseq tree graphics in the
# # Using plot_tree() with the esophagus dataset.
# # Please note that many more interesting examples are shown
# # in the online tutorials"
# # http://joey711.github.io/phyloseq/plot_tree-examples
data(esophagus)
# plot_tree(esophagus)
# plot_tree(esophagus, color="Sample")
# plot_tree(esophagus, size="Abundance")
# plot_tree(esophagus, size="Abundance", color="samples")
plot_tree(esophagus, size="Abundance", color="Sample", base.spacing=0.03)
plot_tree(esophagus, size="abundance", color="samples", base.spacing=0.03)
Run the code above in your browser using DataLab