| plot_network | R Documentation | 
There are many useful examples of phyloseq network graphics in the
phyloseq online tutorials.
A custom plotting function for displaying networks
using advanced ggplot2 formatting.
The network itself should be represented using
the igraph package.
For the phyloseq-package it is suggested that the network object
(argument g)
be created using the
make_network function, 
and based upon sample-wise or taxa-wise microbiome ecological distances 
calculated from a phylogenetic sequencing experiment 
(phyloseq-class).
In this case, 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.
plot_network(g, physeq=NULL, type="samples", color=NULL, shape=NULL, point_size=4, alpha=1, label="value", hjust = 1.35, line_weight=0.5, line_color=color, line_alpha=0.4, layout.method=layout.fruchterman.reingold, title=NULL)
| g | (Required). An  | 
| physeq | (Optional). Default  | 
| type | (Optional). Default  | 
| color | (Optional). Default  | 
| shape | (Optional). Default  | 
| point_size | (Optional). Default  | 
| alpha | (Optional). Default  | 
| label | (Optional). Default  | 
| hjust | (Optional). Default  | 
| line_weight | (Optional). Default  | 
| line_color | (Optional). Default  | 
| line_alpha | (Optional). Default  | 
| layout.method | (Optional). Default  | 
| title | (Optional). Default  
 | 
A ggplot2 plot representing the network,
with optional mapping of variable(s) to point color or shape.
This code was adapted from a repo original hosted on GitHub by Scott Chamberlain: https://github.com/SChamberlain/gggraph
The code most directly used/modified was first posted here: http://www.r-bloggers.com/basic-ggplot2-network-graphs/
make_network
data(enterotype) ig <- make_network(enterotype, max.dist=0.3) plot_network(ig, enterotype, color="SeqTech", shape="Enterotype", line_weight=0.3, label=NULL) # Change distance parameter ig <- make_network(enterotype, max.dist=0.2) plot_network(ig, enterotype, color="SeqTech", shape="Enterotype", line_weight=0.3, label=NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.