[R] panel.xyplot : incorrectly "connecting" points

Deepayan Sarkar deepayan.sarkar at gmail.com
Thu Jan 26 01:35:12 CET 2006


On 1/25/06, Greg Tarpinian <sasprog474474 at yahoo.com> wrote:
> R 2.2, WinXP.  I am having problems getting the right kind of
> xyplot( ) to be generated.  The first of these works fine, but
> doesn't overlay a reference grid (which I need):
>
> xyplot(Y ~ X | Factor1, type = 'b', groups = GROUP,
> col = c(1,13), pch = c(16,6), lty = 1, lwd = 2,
> cex = 1.2, data = FOO.Frame,
> between = list(x = .5, y = .5),
> scales = list(alternating = TRUE))

The simplest solution is to use

type = c('b', 'g')

> The second of these displays the grid as I need, but incorrectly
> "connects" the points from _different_ GROUP values within each
> panel.  I have made sure that GROUP is an ordered factor:
>
> xyplot(PROB ~ MEAN | SD, data = SimProb,
> groups = GROUP,							
> between = list(x = .5, y = .5),
> scales = list(alternating = TRUE),
> panel = function(x, y, ...)
>    {
>     panel.grid(h=-1, v=-1, lwd = 1)
>     panel.xyplot(x, y, type = 'b', col = 1,
>                  lwd = 2, cex = 1.2, ...)
>    }
>    )

This should work in the devel version of R (2.3.0 to be). The reason
it doesn't work in 2.2.x is that the default panel function when
'groups' in non-null is not panel.xyplot, but rather panel.superpose.
(This is admittedly confusing, hence the change for 2.3.0.)

Deepayan
--
http://www.stat.wisc.edu/~deepayan/




More information about the R-help mailing list