Microbiome Network Plot using ggplot2
There are many useful examples of phyloseq network graphics in the
phyloseq online tutorials.
A custom plotting function for displaying networks
using advanced 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)
physeq |
(Required).
The |
distance |
(Optional). Default is |
type |
(Optional). Default |
maxdist |
(Optional). Default |
laymeth |
(Optional). Default |
color |
(Optional). Default |
shape |
(Optional). Default |
rescale |
(Optional). Logical. Default |
point_size |
(Optional). Default |
point_alpha |
(Optional). Default |
point_label |
(Optional). Default |
hjust |
(Optional). Default |
title |
(Optional). Default |
Original network plotting functions:
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")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.