[R] Drawing rectangles in multiple panels
williams222 at llnl.gov
Wed Jul 11 19:22:06 CEST 2007
Thanks for the clarification. The rectangles are completely external
to the panel data, and correspond to 90% confidence intervals built
from training data, to be overlaid on these graphs of the test data.
At 10:04 AM 7/11/2007, you wrote:
>On 7/11/07, Jonathan Williams <williams222 at llnl.gov> wrote:
>>I'm having some trouble understanding the intricacies of panel
>>functions. I wish to create three side-by-side graphs, each with
>>different data-- so far, so good: I rbind() the data, add a column of
>>subscripts as a conditioning variable, load up the lattice package,
>>specify either a c(3,1) 'layout' or work through 'allow.multiple' and
>>'outer' and I'm good to go.
>>But now I wish to add three rectangles to each plot, which will be in
>>different places on each panel, and I'm terribly stuck. I can guess
>>this requires defining a panel function on the fly, but none of my
>>attempts are working. Suggestions?
>You haven't told us what determines the rectangles (only that they are
>different in each panel). If they are completely driven by panel data,
>here's an example:
> function(x, y, ...)
> xq <- quantile(x, c(0.1, 0.9))
> yq <- quantile(y, c(0.1, 0.9))
> panel.rect(xq, yq, xq, yq,
> col = "grey86", border = NA)
> panel.xyplot(x, y, ...)
>xyplot(Sepal.Length ~ Sepal.Width | Species, iris,
> panel = panel.qrect)
>If the rectangles are somehow determined externally, you probably want
>to use one of the accessor functions described in help(panel.number).
>There are good and bad (i.e. less robust) ways to use these, but we
>need to know your use case before recommending one.
More information about the R-help