plot_landscape: Landscape Plot

View source: R/plot_landscape.R

plot_landscapeR Documentation

Landscape Plot

Description

Wrapper for visualizing sample similarity landscape ie. sample density in various 2D projections.

Usage

plot_landscape(
  x,
  method = "PCoA",
  distance = "bray",
  transformation = "identity",
  col = NULL,
  main = NULL,
  x.ticks = 10,
  rounding = 0,
  add.points = TRUE,
  adjust = 1,
  size = 1,
  legend = FALSE,
  shading = TRUE,
  shading.low = "#ebf4f5",
  shading.high = "#e9b7ce",
  point.opacity = 0.75
)

Arguments

x

phyloseq-class object or a data matrix (samples x features; eg. samples vs. OTUs). If the input x is a 2D matrix then it is plotted as is.

method

Ordination method, see phyloseq::plot_ordination; or "PCA", or "t-SNE" (from the Rtsne package)

distance

Ordination distance, see phyloseq::plot_ordination; for method = "PCA", only euclidean distance is implemented now.

transformation

Transformation applied on the input object x

col

Variable name to highlight samples (points) with colors

main

title text

x.ticks

Number of ticks on the X axis

rounding

Rounding for X axis tick values

add.points

Plot the data points as well

adjust

Kernel width adjustment

size

point size

legend

plot legend TRUE/FALSE

shading

Add shading in the background.

shading.low

Color for shading low density regions

shading.high

Color for shading high density regions

point.opacity

Transparency-level for points

Details

For consistent results, set random seet (set.seed) before function call. Note that the distance and transformation arguments may have a drastic effect on the outputs.

Value

A ggplot plot object.

Examples


data(dietswap)

# PCoA
p <- plot_landscape(transform(dietswap, "compositional"),
   distance = "bray", method = "PCoA")

p <- plot_landscape(dietswap, method = "t-SNE", distance = "bray",
       transformation = "compositional")

# PCA
p <- plot_landscape(dietswap, method = "PCA", transformation = "clr")


microbiome/microbiome documentation built on Aug. 22, 2023, 7:12 a.m.