| plotByGroup | R Documentation |
Visualize one categorical column and one numeric column
plotByGroup(x, x.factor = NULL, y.numeric = NULL)
x |
|
x.factor |
A column in |
y.numeric |
A column in |
A simple plotting utility for visualization of one categorical
and numerical variable. Provided a categorical variable and numerical
variable present in sample_data of a
phyloseq-class object, a comparative visualization
can be done.
a ggplot object.
Sudarshan A. Shetty
Shetty SA (2021). Data visualization for microbiome analytics. https://github.com/microsud/biomeViz
library(biomeUtils)
library(biomeViz)
library(dplyr)
library(microbiome)
library(ggplot2)
ps <- FuentesIliGutData
# calculate Shannon diversity using microbiome::diversity and add it to
# the sample_data in phyloseq using biomeUtils::mutateSampleData()
ps <- mutateSampleData(ps,
Shannon = microbiome::diversity(ps, "shannon")[,1])
plotByGroup(ps,
x.factor="ILI",
y.numeric = "Shannon") +
geom_point(aes(color=ILI),
position = position_jitter(width = 0.1)) +
scale_color_manual(values=c("steelblue", "brown3", "grey70"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.