Re: [R] dev.off() inside a function & other glitches

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Tue, 01 Jul 2008 19:49:04 -0400

Michael Hopkins wrote:
> Hi R people
>
> I am using a function to create a pdf device, then send a lot of plots
> to it in a loop then a last lattice xyplot (itself within a function)
> outside the loop and finally call dev.off() to write to the file.
> This works well apart from the fact that the last plot does not get
> sent to the file unless I comment out dev.off() and then apply it in
> the console afterwards instead:
>
> plot_stuff( ...); dev.off()
>
dev.off() shouldn't care where it is being called from. Please post (short!) reproducible code to show your glitch.

Duncan Murdoch
> The device is opened like this:
>
> pdf( paste( var_string, ".pdf", sep="" ), onefile=TRUE, paper="a4r",
> width=9, height=6.5 )
>
> Also, if I try to send two different xyplots after the loop only the
> last one ever gets written to the file, whether or not I apply the
> dev.off() trick above.
>
> Any thoughts on why this stuff happens and best ways to avoid it are
> appreciated.
>
> Other info -> R 2.7.1 on Intel Mac 10.5.3.
>
> TIA
>
> Michael
>
> ______________________________________________
>
> Hopkins Research Touch the Future
> ______________________________________________
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_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.
>



R-help_at_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. Received on Tue 01 Jul 2008 - 23:54:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Jul 2008 - 00:31:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive