Like geom_text(), but each label sits on an opaque rounded box, so it stays readable over dense data.

geom_label(
  mapping = NULL,
  data = NULL,
  color = NULL,
  fill = NULL,
  size = NULL,
  alpha = NULL,
  padding = NULL
)

Arguments

mapping, data

Standard layer overrides. Requires label.

color

Text and border colour.

fill

Plate fill colour.

size

Text size in px.

alpha

Plate opacity.

padding

Plate padding as a fraction of the text size.

Value

A Layer to add with +.

Examples

d <- data.frame(x = c(1, 2), y = c(2, 1), l = c("alpha", "beta"))
ggnext(d, aes(x, y, label = l)) + geom_label()
#> <ggnext plot>
#>   data:  2 x 3
#>   aes:   x = x, y = y, label = l
#>   layers: 1 
#>   coord: cartesian
#>   mode:  static