Makes an animated plot showing the the distances between each sample and a set of reference samples
plot_dist_to_reference_samples.Rd
Makes an animated plot showing the the distances between each sample and a set of reference samples
Usage
plot_dist_to_reference_samples(
physeq,
reference_samples,
x_variable,
return_ggplot = FALSE,
...
)
Arguments
- physeq
A phyloseq object containing species abundances, a phylogenetic tree, and sample data
- reference_samples
Either the names or the indices of the set of reference samples.
- x_variable
A string giving the variable for plotting the distances against on the x axis. Should be the name of one of the columns of
sample_data(phy_seq)
.- return_ggplot
If TRUE, the function will return a ggplot object which can be made into an animated plot by calling ggplotly on it. If FALSE, the function will create the animated plot. The option of returning the ggplot object is primarily to allow for more customization by the user.
- ...
Extra objects to be passed to
aes_string
in ggplot.
Value
Either an animated plot created by ggplotly
(if
return_ggplot = FALSE
) or a ggplot object (if return_ggplot = TRUE
)
Examples
data(gentry)
gentry_log = gentry
otu_table(gentry_log) = log(otu_table(gentry) + 1)
equatorial_samples = sample_names(gentry_log)[which(sample_data(gentry_log)$Lat >= -10 & sample_data(gentry_log)$Lat <= 10)]
plot_dist_to_reference_samples(physeq = gentry_log, reference_samples = equatorial_samples,x_variable = "Lat")
#> Warning: Ignoring unknown aesthetics: frame