Escape hatch for advanced ggplot2 usage: add_ggplot(p, ggplot2::annotate(...)), add_ggplot(p, ggplot2::guides(...)),
add_ggplot(p, ggplot2::labs(...)) etc. modify the underlying ggplot
and return the plotit object so the pipeline continues. Prefer the
verb API (mark_*, scale_*, label_*, style) for reproducible,
well-validated plots.
Stability
Extension surface (contract tier: extensible). The signature is stable as
documented; it is the supported replacement for the former S3 + operator
on plotit objects, which is intentionally not defined so that ggplot2
components are only added through this single explicit entry point.
ggplot2 4.0's ggplot2::stat_manual() slots in here as a custom
data-transformation layer without a dedicated plotit verb:
add_ggplot(p, ggplot2::stat_manual(fun = function(d) ...)).
Examples
p <- plotit(iris, encode(x = Sepal.Width, y = Sepal.Length)) |>
mark_point() |>
add_ggplot(ggplot2::annotate("text", x = 2.5, y = 7.9, label = "high", size = 3))