biplot_pcoa: Draw a principal coordinate biplot using Bray-Curtis...

Description Usage Arguments Value Examples

Description

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

Usage

1
2
3
biplot_pcoa(physeq, color = "Group", shape = NULL, axis1 = 1, axis2 = 2,
  show.taxa = TRUE, label = "Genus", repel = FALSE, show.legend = TRUE,
  custom_palette = NULL)

Arguments

physeq

Phyloseq object.

color

Name of the sample metadata column to color the samples with.

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.taxa

logical. Should the taxa be shown in the biplot? Without taxa, this becomes a standard PCoA plot.

label

Taxonomic annotation of the taxon to be shown in the biplot.

repel

logical. Should the taxa names in the biplot use ggrepel to display all taxa in a non-overlapping manner? If FALSE, then only non-overlapping taxa are shown to improve readability.

show.legend

logical. Should the legend be drawn?

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
22
23
24
25
26
27
28
## Not run: 

# Show samples and taxa in a biplot
biplot_pcoa(physeq, color="Diet")

# Don't show taxa - equivalient to plot_pcoa()
biplot_pcoa(physeq, color="Diet", show.taxa = FALSE)

# Specify color and shape
biplot_pcoa(physeq, color="Diet", shape="Diet", point_size = 2)
biplot_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")
biplot_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)

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

## End(Not run)

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