ggplot
2 formatting.
Note that this function is a performance and interface revision to
plot_network
, which requires an igraph
object as its first argument.
This new function is more in-line with other
plot_*
functions in the phyloseq-package
, in that its
first/main argument is a phyloseq-class
instance.
Edges in the network are created if the distance between
nodes is below a (potentially arbitrary) threshold,
and special care should be given to considering the choice of this threshold.
However, network line thickness and opacity is scaled according to the
similarity of vertices (either samples or taxa),
helping to temper, somewhat, the effect of the threshold.
Also note that the choice of network layout algorithm can have a large effect
on the impression and interpretability of the network graphic,
and you may want to familiarize yourself with some of these options
(see the laymeth
argument).plot_net(physeq, distance = "bray", type = "samples", maxdist = 0.7,
laymeth = "fruchterman.reingold", color = NULL, shape = NULL,
rescale = FALSE, point_size = 5, point_alpha = 1, point_label = NULL,
hjust = 1.35, title = NULL)
phyloseq-class
object that you want to represent as a network."bray"
.
Can be either a distance method supported by distance
,
or an already-computed dist
-class with labels that match
the indices implied by both the physeq
and type
arguments
(that is, either sample or taxa names).
If you used distance
to pre-calculate your dist
ance,
and the same type
argument as provided here, then they will match."samples"
.
Whether the network represented in the primary argument, g
,
is samples or taxa/OTUs.
Supported arguments are "samples"
, "taxa"
,
where "taxa"
indicates using the taxa indices,
whether they actually represent species or some other taxonomic rank.0.7
.
The maximum distance value between two vertices
to connect with an edge in the graphic."fruchterman.reingold"
.
A character string that indicates the method that will determine
the placement of vertices, typically based on conectedness of vertices
and the number of vertices.
This is an interesting topic, and there are lots of options.
See igraph-package
for related topics in general,
and see layout.auto
for descriptions of various
alternative layout method options supported here.
The character string argument should match exactly the
layout function name with the "layout."
omitted.
Try laymeth="list"
to see a list of options.NULL
.
The name of the sample variable in physeq
to use for color mapping
of points (graph vertices).NULL
.
The name of the sample variable in physeq
to use for shape mapping.
of points (graph vertices).FALSE
.
Whether to rescale the distance values to be [0, 1]
, in which the
min value is close to zero and the max value is 1.5
.
The size of the vertex points.1
.
A value between 0 and 1 for the alpha transparency of the vertex points.NULL
.
The variable name in physeq
covariate data to map to vertex labels.1.35
.
The amount of horizontal justification to use for each label.NULL
. Character string.
The main title for the graphic.data(enterotype)
plot_net(enterotype, color="SeqTech", maxdist = 0.3)
plot_net(enterotype, color="SeqTech", maxdist = 0.3, laymeth = "auto")
plot_net(enterotype, color="SeqTech", maxdist = 0.3, laymeth = "svd")
plot_net(enterotype, color="SeqTech", maxdist = 0.3, laymeth = "circle")
plot_net(enterotype, color="SeqTech", shape="Enterotype", maxdist = 0.3, laymeth = "circle")
Run the code above in your browser using DataLab