Amir Safari
2006-Jun-26 16:14 UTC
[R] How to generate a figure using par( ) with some densityplot( )'s
Hi Dear R users, For a pair plotting, usaully we use par( ) function. Apparently it does not work anywhere. I want to have 3 plots in a single figure, like this: par(mfrow=c(3,1)) densityplot( a) densityplot(b) densityplot(c) But it does not work. How is it possible to have such a figure with densityplot( ) in a single figure? So many thanks for any help. Amir Safari --------------------------------- [[alternative HTML version deleted]]
Sundar Dorai-Raj
2006-Jun-26 16:20 UTC
[R] How to generate a figure using par( ) with some densityplot( )'s
Amir Safari wrote:> > Hi Dear R users, > For a pair plotting, usaully we use par( ) function. Apparently it does not work anywhere. I want to have 3 plots in a single figure, like this: > par(mfrow=c(3,1)) > densityplot( a) > densityplot(b) > densityplot(c) > But it does not work. How is it possible to have such a figure with densityplot( ) in a single figure? > So many thanks for any help. > Amir Safari > > >Assuming you are talking about densityplot in lattice, then you are missing the point of lattice. You should try: library(lattice) set.seed(1) a <- rnorm(100) b <- rnorm(50) c <- rnorm(75) densityplot(~a + b + c, outer = TRUE, layout = c(3, 1)) Set "outer" to FALSE to overlay the densities (this is the default behavior). You should remove the "layout" argument in that case, though. HTH, --sundar