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

Deepayan Sarkar deepayan.sarkar at gmail.com
Fri Jan 28 12:29:02 CET 2011


On Fri, Jan 21, 2011 at 8:22 PM, Fabrice Tourre <fabrice.ciup at gmail.com> wrote:
> 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?

See ?print.trellis for an overview of your options.

-Deepayan



More information about the R-help mailing list