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

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Thu 26 Jan 2006 - 11:35:12 EST

On 1/25/06, Greg Tarpinian <sasprog474474@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/

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Jan 26 11:43:21 2006

This archive was generated by hypermail 2.1.8 : Thu 26 Jan 2006 - 16:29:07 EST