library(ggtibble)
library(ggplot2)
d_plot <-
data.frame(
A = rep(c("foo", "bar"), each = 4),
B = 1:8,
C = 11:18,
Bunit = "mg",
Cunit = "km"
)
all_plots <-
ggtibble(
d_plot,
ggplot2::aes(x = B, y = C),
outercols = c("A", "Bunit", "Cunit"),
caption = "All the {A}",
labs = list(x = "B ({Bunit})", y = "C ({Cunit})")
) +
ggplot2::geom_point() +
ggplot2::geom_line()
print(all_plots %+% ggplot2::aes(y = B))
#> NULL
all_plots$figure[[1]] %+% ggplot2::aes(y = B)

Created on 2024-12-07 with reprex v2.1.1