Spaghetti Plots
plot_spaghetti(
x,
plot.var = "by_taxa",
select.taxa = NULL,
xvar = NULL,
group = NULL,
line.bg.color = "#8d99ae",
bg.opacity = 0.5,
focus.color = "brown3",
ncol = NULL,
nrow = NULL,
focus.line.size = 0.5,
line.size = 1
)
phyloseq-class
object
One of "by_sample":Many sample one taxa or "by_taxa":Many taxa one sample
a character list of taxa to be plotted. eg. select.taxa <- c("OTU-370251", "OTU-311173", "OTU-341024").
X-axis variable. This can be visit_number for participants in subject_id.
Column describing sample that have multiple measurements. For e.g. Subject_Ids which has all subject_ids listed.
Line color for background. Default ="#8d99ae",
Line opacity for background.
Line color for focus being plotted.
if wrap, specify number of columns.
if wrap, specify number of rows.
Line size for focus being plotted.
Line size for background.
ggplot
object. This can be further modified using ggpubr.
if (FALSE) {
# Example data
library(microbiomeutilities)
data("hmp2")
pseq <- hmp2 # Ren
pseq.rel <- microbiome::transform(pseq, "compositional")
pseq.relF <- format_to_besthit(pseq.rel)
# Choose one participant
phdf.s <- subset_samples(pseq.relF, subject_id ==
"Participant_1")
# Choose top 12 taxa to visualize
ntax <- top_taxa(phdf.s, 12)
phdf.s <- prune_taxa(ntax, phdf.s)
plot_spaghetti(phdf.s,
plot.var = "by_taxa",
select.taxa = ntax,
xvar = "visit_number",
line.bg.color = "#8d99ae",
focus.color = "#555b6e",
ncol = 3,
nrow = 4,
line.size = 0.2
)
print(p)
}