[R] Bug or feature in xyplot?

Deepayan Sarkar deepayansarkar at yahoo.com
Mon Jul 29 07:26:05 CEST 2002


--- Hans Gardfjell <hans at eg.umu.se> wrote:
> Hi,
> 
> Can someone of you tell me why these two simple examples works as
> "expected",
> 
>   plot(c(1,1,2,2)~c(1,2,1,2),col=c(1,2,3,4),pch=c(1,2,3,4))
> 
> coplot(c(1,1,2,2)~c(1,2,1,2)|c("A","A","B","B"),col=c(1,2,3,4),pch=c(1,2,3,4
> ))
> 
> but when I try it with xyplot in the lattice package it fails.
> 
> 
> xyplot(c(1,1,2,2)~c(1,2,1,2)|c("A","A","B","B"),col=c(1,2,3,4),pch=c(1,2,3,4
> ))
> 
> Do I have to specify colors and symbol types differently with lattice
> functions or
> is this a bug?

Depends on which part you think is unexpected. Both panels should use pch 1 and
2 (and not 3 and 4 for the second panel like coplot), which seems reasonable
enough; it starts afresh for each panel. The col isn't vectorized because grid
doesn't support vectorized graphical parameters yet (but will do so from the
next version).

That said, from a design perspective, col and pch should not be vectors at all
in your example. S-Plus would actually ignore vectorized col/pch etc (with a
warning) and use only the first values. Multiple graphical symbols are supposed
to be achieved via the groups argument and panel.superpose.

Deepayan



__________________________________________________



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list