subset_ord_plot: Subset points from an ordination-derived ggplot

View source: R/plot-methods.R

subset_ord_plotR Documentation

Subset points from an ordination-derived ggplot

Description

Easily retrieve a plot-derived data.frame with a subset of points according to a threshold and method. The meaning of the threshold depends upon the method. See argument description below. There are many useful examples of phyloseq ordination graphics in the phyloseq online tutorials.

Usage

subset_ord_plot(p, threshold=0.05, method="farthest")

Arguments

p

(Required). A ggplot object created by plot_ordination. It contains the complete data that you want to subset.

threshold

(Optional). A numeric scalar. Default is 0.05. This value determines a coordinate threshold or population threshold, depending on the value of the method argument, ultimately determining which points are included in returned data.frame.

method

(Optional). A character string. One of c("farthest", "radial", "square"). Default is "farthest". This determines how threshold will be interpreted.

farthest

Unlike the other two options, this option implies removing a certain fraction or number of points from the plot, depending on the value of threshold. If threshold is greater than or equal to 1, then all but threshold number of points farthest from the origin are removed. Otherwise, if threshold is less than 1, all but threshold fraction of points farthests from origin are retained.

radial

Keep only those points that are beyond threshold radial distance from the origin. Has the effect of removing a circle of points from the plot, centered at the origin.

square

Keep only those points with at least one coordinate greater than threshold. Has the effect of removing a “square” of points from the plot, centered at the origin.

Value

A data.frame suitable for creating a ggplot plot object, graphically summarizing the ordination result according to previously-specified parameters.

See Also

phyloseq online tutorial for this function.

plot_ordination

Examples

## See the online tutorials.
## http://joey711.github.io/phyloseq/subset_ord_plot-examples

joey711/phyloseq documentation built on Nov. 4, 2022, 1:16 a.m.