Lattice xyplot() renders only white background
Closed this issue · 2 comments
chrislarsenqlik commented
Hi, This is probably not an "issue" but more of a general question about Rio's (RServe's?) capabilities. I am trying to use a lattice graphic saved as .png using the ex5.R example but when using lattice it saves as a white-only image. plot(1:10)
works fine for me. Here is the ex5.R script I'm trying to use, which does work in my R Console..
createDummyPlot <- function () {
filename <- tempfile("plot", fileext = ".png")
png(filename)
library(lattice)
state <-data.frame(state.x77,region=state.region)
xyplot(Life.Exp ~ Income | region, data = state, layout = c(4,1))
dev.off()
image <- readBin(filename, "raw", 29999)
unlink(filename)
image
}
Thanks in advance,
Chris
albertosantini commented
This behavior is a FAQ for lattice commands.
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f
createDummyPlot <- function () {
library(lattice)
filename <- tempfile("plot", fileext = ".png")
state <-data.frame(state.x77,region=state.region)
tmp <- xyplot(Life.Exp ~ Income | region, data = state, layout = c(4,1))
png(filename)
print(tmp)
dev.off()
image <- readBin(filename, "raw", 29999)
unlink(filename)
image
}
chrislarsenqlik commented
Aha! Thanks