plot_pcoa: Draw a principal coordinate plot using Bray-Curtis...

Description Usage Arguments Value Examples

Description

Draw a principal coordinate plot using Bray-Curtis dissimilarity measure.

Usage

1
2
plot_pcoa(physeq, color = NULL, shape = NULL, axis1 = 1, axis2 = 2,
  show.legend = TRUE, point_size = 2, custom_palette = NULL)

Arguments

physeq

Phyloseq object.

color

Name of the sample metadata column to color the samples with. If NULL, first column will be used.

shape

Name of the sample metadata column to assign shapes for the samples.

axis1

Index of the principal component to draw in X-axis.

axis2

Index of the principal component to draw in Y-axis.

show.legend

logical. Should the legend be drawn?

point_size

Size of the data points in the PCoA.

custom_palette

Custom palette list to use (see example).

Value

ggplot object with the biplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
plot_pcoa(physeq, color="Diet")
plot_pcoa(physeq, color="Diet", shape="Diet", point_size = 2)
plot_pcoa(physeq, color="Diet", shape="Diet", axis1 = 1, axis2 = 3, show.legend = FALSE, point_size = 2)

# custom palette can be just names of ColorBrewer palettes

pal = list(Diet = "Set2", Enterotype = "Pastel1", Significance = "PuRd")
plot_pcoa(physeq, color="Diet", shape="Diet", point_size = 2, custom_palette = pal) + ggtitle("Fecal samples") + theme(plot.title = element_text(size = 7, face = "bold", hjust = 0.5), legend.position = "right")

# Or it can also be named lists for all possible values.

diet_colors = c(Control="black", HSD="#4A57A2")
ET_colors = c("red", "black", "blue")
names(ET_colors) = c("ET1", "ET2", "ET3")
pal = list(Diet = diet_colors, Enterotype = ET_colors)

plot_pcoa(physeq, color="Diet", shape="Diet", custom_palette = pal)
plot_pcoa(physeq, color="Enterotype", shape="Diet", custom_palette = pal)

## End(Not run)

TBrach/MicrobiomeX documentation built on May 14, 2019, 2:28 p.m.