How can I include multiple grobs object in ggplot plot chart without using annotation_customall the time?
This is my code:
df <- data.frame(x = 1:10, y = 1:10)
df2 <- data.frame(x = 1 , y = 1)
g <- ggplotGrob(ggplot(df2, aes(x, y)) +
geom_point() +
theme(plot.background = element_rect(colour = "black")))
base <- ggplot(df, aes(x, y)) +
geom_blank() +
theme_bw()
base +
annotation_custom(grob = g, xmin = 3, xmax = 2, ymin = 8, ymax = 10)+
annotation_custom(grob = g, xmin = 1.5, xmax = 2.5, ymin = 2.8, ymax = 3)+
annotation_custom(grob = g, xmin = 1.7, xmax = 2.7, ymin = 3.8, ymax = 5)+
annotation_custom(grob = g, xmin = 5, xmax = 6, ymin = 7, ymax = 8.5)
My real problem is bigger, this is just an example.
Is there a way to put all this grobs for example, in a list, and just choose the coordinates that I want to positioning them. Or I need to use annotation_customall the time?
Any help

