Generally, we expect similar count spreads for all genes between samples unless the library sizes or total RNA expression are different.

plotCountsPerFeature(object, ...)

# S4 method for SummarizedExperiment
plotCountsPerFeature(object, assay = 1L,
  interestingGroups = NULL, geom = c("boxplot", "density", "jitter"),
  trans = c("identity", "log2", "log10"), color = getOption(x =
  "acid.color.discrete", default = acidplots::scale_color_synesthesia_d()),
  fill = getOption(x = "acid.fill.discrete", default =
  acidplots::scale_fill_synesthesia_d()), labels = list(title =
  "Counts per feature", subtitle = NULL, sampleAxis = NULL, countAxis =
  "counts"), flip = getOption(x = "acid.flip", default = TRUE),
  minMethod = c("absolute", "perRow"))

# S4 method for SingleCellExperiment
plotCountsPerFeature(object, ...)





vector(1). Assay name or index position.


character. Groups of interest to use for visualization. Corresponds to factors describing the columns of the object.


character(1). Type of ggplot2 geometric object to use.


character(1). Apply a log transformation (e.g. log2(x + 1L)) to the count matrix prior to melting, if desired. Use "identity" to return unmodified (default).


ScaleDiscrete. Desired ggplot2 color scale. Must supply discrete values. When set NULL, the default ggplot2 color palette will be used. If manual color definitions are desired, we recommend using ggplot2::scale_color_manual().

To set the discrete color palette globally, use:

options(acid.color.discrete = ggplot2::scale_color_viridis_d())

ggproto/ScaleDiscrete. Desired ggplot2 fill scale. Must supply discrete values. When set to NULL, the default ggplot2 color palette will be used. If manual color definitions are desired, we recommend using ggplot2::scale_fill_manual().

To set the discrete fill palette globally, use:

options(acid.fill.discrete = ggplot2::scale_fill_viridis_d())

list. ggplot2 labels. See ggplot2::labs() for details.


logical(1). Flip x and y axes. Recommended for plots containing many samples.


character(1). Only applies when min argument is numeric. Uses match.arg().

  • absolute: Applies hard cutoff to counts column after the melt operation. This applies to all counts, not per feature.

  • perRow: Applies cutoff per row (i.e. gene). Internally, rowSums() values are checked against this cutoff threshold prior to the melt operation.


Additional arguments.



Methods (by class)

  • SingleCellExperiment: Applies aggregateCellsToSamples() calculation to summarize at sample level prior to plotting.
    Passes ... to SummarizedExperiment method.


Updated 2019-09-16.


data( RangedSummarizedExperiment, SingleCellExperiment, package = "acidtest" ) ## SummarizedExperiment ==== object <- RangedSummarizedExperiment plotCountsPerFeature(object, geom = "boxplot")
plotCountsPerFeature(object, geom = "density")
## SingleCellExperiment ==== object <- SingleCellExperiment plotCountsPerFeature(object)
#> Aggregating counts using 'sum()'.
#> Filtered zero count rows and columns: #> - 478 / 500 rows (95.6%) #> - 2 / 2 columns (100%)