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

# S3 method for DimReduc
autolayer(
  object,
  data = missing_arg(),
  dims = c(1L, 2L),
  na.rm = TRUE,
  show.legend = NA,
  ...
)

Arguments

object

A DimReduc object

data

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

dims

Dimensions for visualization

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_point

Value

A geom_point 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

  • color

See also

ggplot2::autolayer(), ggplot2::geom_point()

Visualize Dimensional Reductions: autoplot.DimReduc(), fortify.DimReduc()

Examples

data("pbmc_small")
tsne <- pbmc_small[["tsne"]]
md <- FetchData(pbmc_small, vars = c("ident", "MS4A1"))

# Generate a plot using `autolayer()`
ggplot() + autolayer(tsne)

ggplot() + autolayer(tsne, data = md)