Is there a way to have R plot to an in-memory object or connection, rather than a named file?
I would like to have a plotting server create many graphs without ever going to a file.
The Cairo package documents use of a connection, but it doesn't seem to work. What I would like to do is something like:
library(Cairo)
plot.to.var <- function(data) {
tc = textConnection("output", "w")
CairoPDF(tc)
plot(data)
dev.off()
tc.close()
output
}
When I do this, CairoPDF mentions a connection patch I can't find a reference to, that will allow me to do this, even though the documentation shows this working.
I have no particular desire to use Cairo, merely saw that the documentation mentioned this.
Any ideas?