A two-dimensional embedding scatter with optional cluster hulls, so cluster shape is visible rather than inferred from point color alone.

geom_embedding(
  mapping = NULL,
  data = NULL,
  hull = TRUE,
  size = NULL,
  alpha = NULL
)

Arguments

mapping, data

Standard layer overrides. Map the two embedding dimensions to x and y, and the cluster to color.

hull

Draw a convex hull around each cluster.

size

Point radius.

alpha

Point opacity.

Value

A Layer to add with +.

Examples

set.seed(1)
d <- data.frame(
  d1 = c(rnorm(30), rnorm(30, 4)), d2 = c(rnorm(30), rnorm(30, 3)),
  cl = rep(c("a", "b"), each = 30)
)
ggnext(d, aes(d1, d2, color = cl)) + geom_embedding()
#> <ggnext plot>
#>   data:  60 x 3
#>   aes:   x = d1, y = d2, color = cl
#>   layers: 1 
#>   coord: cartesian
#>   mode:  static