Daniel Kornhauser
2009-Jan-30 04:51 UTC
[R] How to generate a xyplot with multiple panels using an empty data frame ?
Hi: I am coding some interactive interface using an xyplot from lattice. When a user clicks on a panel of the xyplot, a simulation is executed and the resulting data is plotted on the corresponding panel. The problem is that I start with an empty data frame and only fill it as the user request data from simulations. And, I have found it impossible to create a conditional plot that contains panels using an empty data frame. For example I want: library(lattice) e = data.frame("a", "b", "c", "d") xyplot(X.a. ~ X.b. | X.c. + X.d., data = e, xlim = c(c(50,60),c(60,70)), ylim = c(c(10,20),c(20,30)), drop.unused.levels=FALSE,layout = c(2,2)) to create a empty xyplot that would look like: 50 60 70 ---------------------------- 10 | | | | | | | | | 20 ---------------------------- | | | | | | 30 | | | ----------------------------- but it doesn't create 4 panels it only creates a single panel: 50 60 70 --------------- 10 | | 20 | | 30 | | ---------------- I am a novice in R so I hope this is not a question that is too easy for the r-devel list. Thanks. Daniel. PS: I got around this problem by creating "dummy" data frames containing data with the sole purpose of indicating xyplot the data ranges. It works well, but I consider it a hack. [[alternative HTML version deleted]]
Maybe Matching Threads
- How to generate a xyplot with multiple panels using an empty data frame ?
- Buggy trellis.focus() with xyplot ?
- Getting the panel location of a xyplot matrix using a mouse click in a GDCanvas
- Help: formatting the result of 'cut' function
- Grouping multiple runs of multiple datasets in lattice's xyplot