davidhodge931 / ggblanket

Simplify ggplot2 visualisation
https://davidhodge931.github.io/ggblanket/
Other
155 stars 8 forks source link

docs: annotate via vline's with key #933

Closed davidhodge931 closed 3 months ago

davidhodge931 commented 3 months ago
library(tidyverse)
library(palmerpenguins)

d <- tibble(
  x = c(190, 210),
  l = c("A", "B"),
)

penguins |>
  gg_blanket(
    x = flipper_length_mm,
    y = body_mass_g,
  ) +
  geom_text(aes(x = x, y = Inf, label = l), data = d, vjust = -0.5) +
  geom_vline(aes(xintercept = x), data = d) +
  geom_point()