Ng Stanley <stanleyngkl <at> gmail.com> writes: > I am faced with a strange problem. My picture file is empty when the > following statements were run from R script. But the picture file shows up > correctly, when the commands are individually run from Rgui. > > png(file="histogram_correlation.png", bg = "white") > require(stats) > histogram( ~ height | voice.part, data = singer, nint = 17, > endpoints = c(59.5, 76.5), layout = c(2,4), aspect = 1, > xlab = "Height (inches)") > dev.off() >
The FAQ of FAQs, but admittely confusing (I remember Douglas Bates calling Deepayan in the middle of the night in India): lattice graphics must be printed in this context. I usually do it in two steps: p = histogram(...) print(p,(add layout if required here)) Dieter ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.