[R] Lattice: Superpose bwplot and dotplot [newbie question]

Stephen Weigand weigand.stephen at gmail.com
Tue Jun 17 00:37:45 CEST 2008


On Mon, Jun 16, 2008 at 4:40 PM, Lord Yo <nabble at sporez.com> wrote:
>
> Hello everyone
>
> I have dataset containing a monetary value (ABS) and two factors (Fct,
> Group).  I am able to create useful using:
>
> bwplot(ABS~Group|Fct)
> and
> dotplot(ABS~Group|Fct)
>
> Question: What do I have to do to overlay the dotplot with the bwplot (same
> data set)?
>
> I've found a couple of posts that hinted at the possibility of doing that,
> and checked the panel.superpose() help, but the info was too complex for my
> newbie brain.
>
> Thanks for your help!
> LY

How about:

y <- rnorm(100)
g <- factor(sample(c("g1", "g2"), size = 100, replace = TRUE))
x <- factor(sample(c("A", "B"), size = 100, replace = TRUE))
bwplot(g ~ y | x,
       panel = function(x, y, ...) {
         panel.dotplot(x, y, ...)
         panel.bwplot(x, y, pch = "|", ...)
       })



-- 
Rochester, Minn. USA



More information about the R-help mailing list