[R] Help for lattice. par(new=TRUE)

Fabrice Tourre fabrice.ciup at gmail.com
Fri Jan 21 15:52:56 CET 2011


Hi list,
I want to plot two plot in the same figure. I set par(new=TRUE). But
it does not work.

library(lattice)
myPanel <- function(x,...)
{
       panel.histogram(x,alpha=0.4,...)
       ltext(0.4,1.5,paste("Mean=","0.05",digit=2)),cex=0.8)
       ltext(0.8,1.5,paste("s.d.=","0.06",digit=2)),cex=0.8)
}
histogram(sh2, type="percent",panel=myPanel,breaks=seq(0,1,by=0.01),ylim=c(0,5),col=rgb(0.1,0.1,0.8,0.5))

par(new=TRUE) #### Here is does not work. Warning message: In par(new
= TRUE) : calling par(new=TRUE) with no plot

histogram(sh2, type="percent",panel=myPanel,breaks=seq(0,1,by=0.01),ylim=c(0,5))

I want to the two hist in the same map. How can I set it in lattice?
Thanks.



More information about the R-help mailing list