[R] Drawing rectangles in multiple panels

deepayan.sarkar at gmail.com deepayan.sarkar at gmail.com
Wed Jul 11 19:54:23 CEST 2007

On 7/11/07, Bert Gunter <gunter.berton at gene.com> wrote:
> Deepayan et. al.:
> 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?

subscripts is absolutely the right thing to use if your auxiliary
information is in the form of vectors than have the same length as the
rest of your data. Examples would include a color for every point in a
xyplot or confidence bounds in a dotplot. However, sometimes your
external information might be a summary; say the parameters defining a
fitted curve for every combination of your conditioning variables (and
the underlying model might have shared information across
combinations, so you wouldn't be able to compute them from the panel
data alone). In that case, which.packet(), which gives you the levels
of the conditioning variables defining the current panel, may be

Of course, there are workarounds using subscripts, or in this example,
adding rows to your data frame containing the fitted values. The
accessors are a convenience that sometimes make life simpler.


More information about the R-help mailing list