plotAbundanceDensity | R Documentation |
This function plots abundance of the most abundant taxa.
plotAbundanceDensity(x, ...)
## S4 method for signature 'SummarizedExperiment'
plotAbundanceDensity(
x,
layout = c("jitter", "density", "point"),
assay.type = assay_name,
assay_name = "counts",
n = min(nrow(x), 25L),
colour.by = colour_by,
colour_by = NULL,
shape.by = shape_by,
shape_by = NULL,
size.by = size_by,
size_by = NULL,
decreasing = order_descending,
order_descending = TRUE,
...
)
x |
a
|
... |
additional parameters for plotting.
See |
layout |
|
assay.type |
|
assay_name |
Deprecate. Use |
n |
|
colour.by |
|
colour_by |
Deprecated. Use |
shape.by |
|
shape_by |
Deprecated. Use |
size.by |
|
size_by |
Deprecated. Use |
decreasing |
|
order_descending |
Deprecated. Use |
This function plots abundance of the most abundant taxa. Abundance can be plotted as a jitter plot, a density plot, or a point plot. By default, x-axis represents abundance and y-axis taxa. In a jitter and point plot, each point represents abundance of individual taxa in individual sample. Most common abundances are shown as a higher density.
A density plot can be seen as a smoothened bar plot. It visualized distribution of abundances where peaks represent most common abundances.
A ggplot2
object
Leo Lahti and Tuomas Borman. Contact: microbiome.github.io
scater::plotExpression
data("peerj13075", package = "mia")
tse <- peerj13075
# Plots the abundances of 25 most abundant taxa. Jitter plot is the default option.
plotAbundanceDensity(tse, assay.type = "counts")
# Counts relative abundances
tse <- transformAssay(tse, method = "relabundance")
# Plots the relative abundance of 10 most abundant taxa.
# "nationality" information is used to color the points. X-axis is log-scaled.
plotAbundanceDensity(
tse, layout = "jitter", assay.type = "relabundance", n = 10,
colour.by = "Geographical_location") +
scale_x_log10()
# Plots the relative abundance of 10 most abundant taxa as a density plot.
# X-axis is log-scaled
plotAbundanceDensity(
tse, layout = "density", assay.type = "relabundance", n = 10 ) +
scale_x_log10()
# Plots the relative abundance of 10 most abundant taxa as a point plot.
# Point shape is changed from default (21) to 41.
plotAbundanceDensity(
tse, layout = "point", assay.type = "relabundance", n = 10,
point.shape = 41)
# Plots the relative abundance of 10 most abundant taxa as a point plot.
# In addition to colour, groups can be visualized by size and shape in point plots,
# and adjusted for point size
plotAbundanceDensity(
tse, layout = "point", assay.type = "relabundance", n = 10,
shape.by = "Geographical_location", size.by = "Age", point.size=1)
# Ordering via decreasing
plotAbundanceDensity(
tse, assay.type = "relabundance", decreasing = FALSE)
# for custom ordering set decreasing = NA and order the input object
# to your wishes
plotAbundanceDensity(
tse, assay.type = "relabundance", decreasing = NA)
# Box plots and violin plots are supported by scater::plotExpression.
# Plots the relative abundance of 5 most abundant taxa as a violin plot.
library(scater)
top <- getTop(tse, top = 5)
plotExpression(tse, features = top, assay.type = "relabundance") + ggplot2::coord_flip()
# Plots the relative abundance of 5 most abundant taxa as a box plot.
plotExpression(tse, features = top, assay.type = "relabundance",
show_violin = FALSE, show_box = TRUE) + ggplot2::coord_flip()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.