Generate a geom_violin layer to add to existing ggplot objects. The new plot data and aesthetics are stored at the geom level

# S3 method for Assay
autolayer(
  object,
  data = missing_arg(),
  features = NULL,
  layer = c("data", "scale.data", "counts"),
  na.rm = TRUE,
  show.legend = NA,
  ...
)

Arguments

object

An Assay object

data

A data.frame (eg. from FetchData) with extra data for visualization

features

A vector of features to include in the fortified data; defaults to the variable features

layer

Name of layer to pull expression data for

na.rm

Remove values with NAs

show.legend

logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display.

...

Arguments passed to geom_violin

Value

A geom_violin layer to add to ggplot objects

Details

The following aesthetics are mapped automatically and overwrite said aesthetics at the plot level if set:

  • x

  • y

  • fill

See also

ggplot2::autolayer(), ggplot2::geom_violin()

Visualize Assay Expression Data: autoplot.Assay(), fortify.Assay()

Examples

data("pbmc_small")
rna <- pbmc_small[["RNA"]]
md <- FetchData(pbmc_small, vars = "ident")

# Generate a plot using `autolayer()`