Skip to content
Back to formatted view

Raw Message

Message-ID: <971536df0809230820s6e540b06k9f63aa0465d2c5b9@mail.gmail.com>
Date: 2008-09-23T15:20:38Z
From: Gabor Grothendieck
Subject: xyplot problem
In-Reply-To: <200809231527.47343.pniklaus@ethz.ch>

xyplot will pass a vector of indices through the subscripts argument
to the panel so try this:

xyplot(y ~ x | grp, panel = function(x, y, subscripts, ...) {
      panel.xyplot(x, y, cex = sz[subscripts], ...)
   }
)

On Tue, Sep 23, 2008 at 9:27 AM, Pascal A. Niklaus <pniklaus at ethz.ch> wrote:
> Hi all,
>
> I am trying to produce some panels with dots in an X/Y plane where the
> diameter of the dots indicates a Z value (like e.g. earthquake maps where dot
> sizes indicate magnitudes and X/Y the location).
>
> This works fine with xyplot, e.g.:
>
> xyplot(1:3~1:3,cex=1:3,pch=16)
>
> However, when I do this with a panel variable, e.g.:
>
> x<-rep(1:3,5)
> y <- rep(1:3,5)
> sz <- rep(1:5,each=3)
> grp <- factor(rep(1:5,each=3))
> xyplot(y~x | grp , cex=sz)
>
> then sz in the cex argument is not applied per group as I would expect. Same
> for other arguments like col.
>
> Is this really the intended behaviour?
>
> How can I achieve what I want, i.e., that the cex argument is different for
> the different levels of grp?
>
> Thank you for your help
>
> Pascal Niklaus
>
> ______________________________________________
> R-help at r-project.org 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.
>