Create ggplot2 graph in memory?

I am trying to capture the result of graphically creating ggplot2 in memory to send it to the server. Does anyone have a good idea how to solve this?

My code looks like this:

data(mtcars) x <- ggplot(mtcars, aes(x=mpg, y=hp)) + geom_point(shape=1) print(x) # RStudio can capture the output, but I'm unable to do it. ggsave(filename="a.jpg", plot=x) # not really a solution, need it not on disk, but as blob in memory. 
+5
source share

Source: https://habr.com/ru/post/1232791/


All Articles