I know I can extract the data I plot in a ggplot2 plot using
ggplot2
p <- ggplot(df, aes(x, y)) + geom_point() ggplot_build(p)$data
p itself is a list, you can get df with p$data.
p
list
df
p$data
A samll example:
library(ggplot2) p <- ggplot(mtcars, aes(x = mpg, y = cyl)) + geom_point() identical(p$data, mtcars) # [1] TRUE