On 7/12/07, Deepayan Sarkar <[EMAIL PROTECTED]> wrote: > On 7/11/07, hadley wickham <[EMAIL PROTECTED]> wrote: > > > A question/comment: I have usually found that the subscripts argument is > > > what I need when passing *external* information into the panel function, > > > for > > > example, when I wish to add results from a fit done external to the > > > trellis > > > call. Fits[subscripts] gives me the fits (or whatever) I want to plot for > > > each panel. It is not clear to me how the panel layout information from > > > panel.number(), etc. would be helpful here instead. Am I correct? -- or is > > > there a smarter way to do this that I've missed? > > > > This is one of things that I think ggplot does better - it's much > > easier to plot multiple data sources. I don't have many examples of > > this yet, but the final example on > > http://had.co.nz/ggplot2/geom_abline.html illustrates the basic idea. > > That's probably true. The Trellis approach is to define a plot by > "data source" + "type of plot", whereas the ggplot approach (if I > understand correctly) is to create a specification for the display > (incrementally?) and then render it. Since the specification can be > very general, the approach is very flexible. The downside is that you > need to learn the language.
Yes, that's right. ggplot basically decomposes "type of plot" into statistical transformation (stat) + geometric object and allows you to control each component separately. ggplot also explicitly includes the idea of layers (ie. one layer is a scatterplot and another layer is a loess smooth) and allows you to supply different datasets to different layers. > On a philosophical note, I think the apparent limitations of Trellis > in some (not all) cases is just due to the artificial importance given > to data frames as the one true container for data. Now that we have > proper multiple dispatch in S4, we can write methods that behave like > traditional Trellis calls but work with more complex data structures. > We have tried this in one bioconductor package (flowViz) with > encouraging results. That's one area which I haven't thought much about. ggplot is very data.frame centric and it's not yet clear to me how plotting a linear model (say) would fit into the grammar. Hadley ______________________________________________ R-help@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 and provide commented, minimal, self-contained, reproducible code.