Hi, When I was using the regular plot() function, I added this: --8<---------------cut here---------------start------------->8--- if (!is.null(file)) { do.call(tools::file_ext(file),list(file = file)) on.exit(dev.off()) cat("writing",file,"\n") } --8<---------------cut here---------------end--------------->8--- to the beginning of each of my functions which plotted anything. now that I am using lattice::xyplot to plot multiple lines, the above code does NOT result in the plot being written to a file. why? I trued passing file=file to xyplot but that appears to be ignored too. so, how do I tell lattice::xyplot to write charts in png files? thanks! -- Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000 http://www.childpsy.net/ http://honestreporting.com http://jihadwatch.org http://think-israel.org http://mideasttruth.com cogito cogito ergo cogito sum
See FAQ 7.22 and fortune("line 800"). cheers, Rolf Turner On 21/12/12 06:29, Sam Steingold wrote:> Hi, > When I was using the regular plot() function, I added this: > > --8<---------------cut here---------------start------------->8--- > if (!is.null(file)) { > do.call(tools::file_ext(file),list(file = file)) > on.exit(dev.off()) > cat("writing",file,"\n") > } > --8<---------------cut here---------------end--------------->8--- > > to the beginning of each of my functions which plotted anything. > now that I am using lattice::xyplot to plot multiple lines, the above > code does NOT result in the plot being written to a file. > why? > > I trued passing file=file to xyplot but that appears to be ignored too. > > so, how do I tell lattice::xyplot to write charts in png files? > > thanks! > >
Hello, A reproducible example would be nice. Anyway, with "lattice::xyplot", you can store, then print the figure, in order to write it into a file: > xyObj <- xyplot(...) > postscript(...) > print(xyObj) > dev.off() Regards, Pascal Le 21/12/2012 02:29, Sam Steingold a ?crit :> Hi, > When I was using the regular plot() function, I added this: > > --8<---------------cut here---------------start------------->8--- > if (!is.null(file)) { > do.call(tools::file_ext(file),list(file = file)) > on.exit(dev.off()) > cat("writing",file,"\n") > } > --8<---------------cut here---------------end--------------->8--- > > to the beginning of each of my functions which plotted anything. > now that I am using lattice::xyplot to plot multiple lines, the above > code does NOT result in the plot being written to a file. > why? > > I trued passing file=file to xyplot but that appears to be ignored too. > > so, how do I tell lattice::xyplot to write charts in png files? > > thanks! > >