[R] Plot command overwrites existing plot in multiple figure plot
David Winsemius
dwinsemius at comcast.net
Tue Jul 12 06:50:31 CEST 2011
On Jul 11, 2011, at 9:24 PM, marcel wrote:
> Hi all,
> I have a figure with 5 separate graphs in a stacked layout. While
> most of my
> plots drop into their appointed spots nicely, my last plot, using
> lattice
> and the plot(object) command insists on wiping out my current plot
> window
> altogether, and just plotting the last figure by itself. The
> relevant part
> of my code is of the form:
>
> nf <-
> layout
> (matrix
> (c(1,1,1,1,0,0,2,2,2,2,0,0,3,3,3,3,0,0,4,4,4,4,0,0,5,5,5,5,0,0),5,6,
> byrow=TRUE), respect=FALSE)
>
> #first plot, plots well
> attach(data1)
> par(mar=c(0.2,4.5,0.2,0.5))
> plot(var1, var2, frame=T, etc..)
> detach(data1)
>
> #second plot, plots fine
> attach(data2)
> par(mar=c(0.2,4.5,0.2,0.5))
> plot(var3, var4, frame=T, etc...)
> detach(data1)
>
> require(lattice)
> tmpdf <- data.frame(Mydata)
> tmpdf #data show up fine
> barchart(values ~ Time, group=ind, data=tmpdf, stack=TRUE,
> horizontal=FALSE)
> xyplot(values ~ Time, group=ind, data=tmpdf, stack=TRUE,
> horizontal=FALSE,
> panel=panel.barchart, ylim=c(-0.05,1.05), xlim=c(0,6))
>
> # Problem here. This command will wipe out my existing window (prints
> briefly and is then quickly replaced by the plot below
> print(xyplot(values ~ Time, group=ind, data=tmpdf, stack=TRUE,
> horizontal=FALSE, panel=panel.barchart, ylim=c(-0.05,1.05),
> xlim=c(0,6)))
>
> Is there any way around this problem?
... on a google search, multiple links to::: r-project mixing grid and
base graphics
www.stat.ucl.ac.be/ISdidactique/Rhelp/library/gridBase/doc/gridBase.pdf
>
> Marcel
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Plot-command-overwrites-existing-plot-in-multiple-figure-plot-tp3661245p3661245.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list