Dear all, I am trying to create a lattice plot which consists of 1 xyplot and 2 histograms (each for x and y). My first try was like this: x<-rnorm(1000) y<-rnorm(1000) xy <- xyplot(y~x) hist.x <- histogram(x) hist.y <- histogram(y) print(xy, position=c(0, 0.2, 1, 1), more=TRUE) print(hist.x, position=c(0, 0, 1, 0.33),more=T) print(hist.y, position=c(0.8, 0, 1, 1)) Ok, this is obviously not the solution. I would appreciate any suggestions anyone could give. Bernd
Hello Bernd, Did you look at the help for layout(). This is probably what you need... Roy -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Bernd Weiss Sent: Monday, June 13, 2005 4:17 PM To: r-help at stat.math.ethz.ch Subject: [R] Lattice: Combining xyplot and histogram Dear all, I am trying to create a lattice plot which consists of 1 xyplot and 2 histograms (each for x and y). My first try was like this: x<-rnorm(1000) y<-rnorm(1000) xy <- xyplot(y~x) hist.x <- histogram(x) hist.y <- histogram(y) print(xy, position=c(0, 0.2, 1, 1), more=TRUE) print(hist.x, position=c(0, 0, 1, 0.33),more=T) print(hist.y, position=c(0.8, 0, 1, 1)) Ok, this is obviously not the solution. I would appreciate any suggestions anyone could give. Bernd ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- The information contained in this communication and any atta...{{dropped}}
Check out this recent thread: Solution using names (except you should use the 'with' implementation from the second link here): https://www.stat.math.ethz.ch/pipermail/r-devel/2005-June/033439.html Solution that traverses children directly (somewhat more open to breaking if grid changes but significantly shorter): https://www.stat.math.ethz.ch/pipermail/r-devel/2005-June/033508.html You might want to read the entire thread since it discusses anticipated enhancements in lattice and grid that will make this even nicer in the future. On 6/13/05, Bernd Weiss <bernd.weiss at uni-koeln.de> wrote:> Dear all, > > I am trying to create a lattice plot which consists of 1 xyplot and 2 > histograms (each for x and y). > > My first try was like this: > > x<-rnorm(1000) > y<-rnorm(1000) > xy <- xyplot(y~x) > hist.x <- histogram(x) > hist.y <- histogram(y) > print(xy, position=c(0, 0.2, 1, 1), more=TRUE) > print(hist.x, position=c(0, 0, 1, 0.33),more=T) > print(hist.y, position=c(0.8, 0, 1, 1)) > > Ok, this is obviously not the solution. I would appreciate any > suggestions anyone could give. > > Bernd > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >
Am 13 Jun 2005 um 11:40 hat Mwalili, S. M. geschrieben:> > See ?layout[...] Thanks to Roy, Gabor and Mwalili for their helpful suggestions. As Gabor wrote, I have to make myself familiar with the grid package and viewports. Bernd