Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

subset_ord_plot

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.

Examples

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

phyloseq

Handling and analysis of high-throughput microbiome census data

v1.34.0
AGPL-3
Authors
Paul J. McMurdie <joey711@gmail.com>, Susan Holmes <susan@stat.stanford.edu>, with contributions from Gregory Jordan and Scott Chamberlain
Initial release
2019-04-23

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.