plotHistogram: Create histogram or barplot of 'assay', 'rowData' or...

plotHistogramR Documentation

Create histogram or barplot of assay, rowData or colData

Description

This methods visualizes abundances or variables from rowData or colData.

Usage

plotHistogram(x, ...)

plotBarplot(x, ...)

## S4 method for signature 'SummarizedExperiment'
plotHistogram(
  x,
  assay.type = NULL,
  features = NULL,
  row.var = NULL,
  col.var = NULL,
  ...
)

## S4 method for signature 'SummarizedExperiment'
plotBarplot(
  x,
  assay.type = NULL,
  features = NULL,
  row.var = NULL,
  col.var = NULL,
  ...
)

Arguments

x

a SummarizedExperiment object.

...

Additional parameters for plotting.

  • layout: Character scalar. Specifies the layout of plot. Must be either "histogram" or "density". (Default: "histogram")

assay.type

NULL or character scalar. Specifies the abundace table to plot. (Default: NULL)

features

NULL or character vector. If assay.type is specified, this specifies rows to visualize in different facets. If NULL, whole data is visualized as a whole. (Default: NULL)

row.var

NULL or character vector. Specifies a variable from rowData(x) to visualize. (Default: NULL)

col.var

NULL or character vector Specifies a variable from colData(x) to visualize. (Default: NULL)

Details

Histogram and bar plot are a basic visualization techniques in quality control. It helps to visualize the distribution of data. plotAbundance allows researcher to visualise the abundance from assay, or variables from rowData or colData. For visualizing categorical values, one can utilize plotBarplot.

plotAbundanceDensity function is related to plotHistogram. However, the former visualizes the most prevalent features, while the latter can be used more freely to explore the distributions.

Value

A ggplot2 object.

See Also

  • plotAbundanceDensity

  • scater::plotExpression

  • scater::plotRowData

  • scater::plotColData

Examples

data(GlobalPatterns)
tse <- GlobalPatterns

# Visualize the counts data. There are lots of zeroes.
plotHistogram(tse, assay.type = "counts")

# Apply transformation
tse <- transformAssay(tse, method = "clr", pseudocount = TRUE)
# And plot specified rows
plotHistogram(tse, assay.type = "clr", features = rownames(tse)[1:10])

# Calculate shannon diversity and visualize its distribution with density
# plot
tse <- addAlpha(tse, index = "shannon")
plotHistogram(tse, col.var = "shannon", layout = "density")

# For categorical values, one can utilize a bar plot
plotBarplot(tse, col.var = "SampleType")


microbiome/miaViz documentation built on April 13, 2025, 3:29 a.m.