Inverse of ggplotGrob?
问题 I have a function which manipulates a ggplot object, by converting it to a grob and then modifying the layers. I would like the function to return a ggplot object not a grob. Is there a simple way to convert a grob back to gg? The documentation on ggplotGrob is awfully sparse. Simple example: P <- ggplot(iris) + geom_bar(aes(x=Species, y=Petal.Width), stat="identity") G <- ggplotGrob(P) ... some manipulation to G ... ## DESIRED: P2 <- inverse_of_ggplotGrob(G) such that, we can continue to use