I ran this script in a source file on my Mac: library(lattice) year <- 1900:2000 dollars <- (year-1899)^2 plot(year,dollars) quartz("year") histogram(~dollars) The first plot appears in Quartz 2. The second quartz window, named year, opens but the histogram doesn't appear. However, when I copy and paste this script directly into the R console, both quartz windows (Quartz 2 and year) open and both plots appear. As a counter example, the script below run as a source file, works as expected, and I get two plots in two windows: library(lattice) year <- 1900:2000 dollars <- (year-1899)^2 plot(year,dollars) quartz("year") plot(year, dollars) How do I get the lattice package to generate multiple plots in multiple windows from a script run from a source file? Thank you ahead of time, Sarah B. [[alternative HTML version deleted]]
Perhaps you're a victim of FAQ 7.22. Try putting a print () around your plot call - e.g., print(histogram(~ dollars)). And please read said FAQ to understand why... HTH, Dennis On Mon, Nov 22, 2010 at 10:11 PM, Sarah Berry <escalosobre@gmail.com> wrote:> I ran this script in a source file on my Mac: > > library(lattice) > year <- 1900:2000 > dollars <- (year-1899)^2 > plot(year,dollars) > quartz("year") > histogram(~dollars) > > The first plot appears in Quartz 2. The second quartz window, named year, > opens but the histogram doesn't appear. > > However, when I copy and paste this script directly into the R console, > both quartz windows (Quartz 2 and year) open and both plots appear. > > As a counter example, the script below run as a source file, works as > expected, and I get two plots in two windows: > > library(lattice) > year <- 1900:2000 > dollars <- (year-1899)^2 > plot(year,dollars) > quartz("year") > plot(year, dollars) > > How do I get the lattice package to generate multiple plots in multiple > windows from a script run from a source file? > > Thank you ahead of time, > > Sarah B. > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >[[alternative HTML version deleted]]
On Nov 23, 2010, at 1:11 AM, Sarah Berry wrote:> I ran this script in a source file on my Mac: > > library(lattice) > year <- 1900:2000 > dollars <- (year-1899)^2 > plot(year,dollars) > quartz("year") > histogram(~dollars) > > The first plot appears in Quartz 2. The second quartz window, named > year, opens but the histogram doesn't appear.Unable to reproduce on my mac using 64 bit GUI. Both plots appears in separate windows. > sessionInfo() R version 2.12.0 (2010-10-15) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8> > However, when I copy and paste this script directly into the R > console, both quartz windows (Quartz 2 and year) open and both plots > appear. > > As a counter example, the script below run as a source file, works > as expected, and I get two plots in two windows: > > library(lattice) > year <- 1900:2000 > dollars <- (year-1899)^2 > plot(year,dollars) > quartz("year") > plot(year, dollars) > > How do I get the lattice package to generate multiple plots in > multiple windows from a script run from a source file? > > Thank you ahead of time, > > Sarah B. > [[alternative HTML version deleted]]David Winsemius, MD West Hartford, CT