View source: R/plot_trajectory.R
plot_trajectory | R Documentation |
When looking at PCA-plots for different time series, we often want to study their evolution in time. This convenience functions does so by adding arrows between the samples in their chronological order in the PCA plot
plot_trajectory( time_series_list, distance = "bray", subset = names(time_series_list), label = FALSE, label_size = 3, color = NULL, linetype = NULL )
time_series_list |
A list of OTU_time_series objects |
distance |
The name of any distance metric in vegdist |
subset |
Character, the subsets of time series to plot, based on the names of the list. |
label |
Logical, should each point be labelled with the time point? |
label_size |
Positive numeric, the font size of the label. Ignored if |
color |
Character, the color mapping to use in the plot. Defaults to the time series |
linetype |
Character, the linetype mapping to be used. Defaults to solid |
The function utilzes the entire table to make the principal components,
even if some data points are excluded. Note the columns 'time_series'
and 'time_points'
which are available in the object being returned.
A ggplot object showing the trajectory in the two first principal components
library(micInt) library(phyloseq) data("seawater") physeq_list <- subdivide_by_environment(seawater,"Reactor") time_series <- lapply(physeq_list$phyloseq,OTU_time_series, time_points = "Week") plot_trajectory(time_series,distance = "euclidean")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.