# [R] Lattice, panel.grid and groups

TEMPL Matthias Matthias.Templ at statistik.gv.at
Wed Apr 12 19:18:45 CEST 2006

```Yes, now it works perfect.
Sorry, I was really blind for a couple of hours. Thank you!
Matthias

On 4/12/06, TEMPL Matthias <Matthias.Templ at statistik.gv.at> wrote:
> Hello,
>
> Given the following plot, which shows following data:
>
>  a  <- c(8.976000, 8.976000, 8.856000, 8.856000, 8.756000, 8.756000,
> 8.771000, 8.751000, 8.856000, 8.856000, 16.812000, 16.800000,
8.845000,
> 9.032000, 8.706000, 9.636000, 9.032000, 16.802000, 8.726000, 8.779000,
> 8.779000, 8.856000, 8.856000, 8.534000, 8.534000, 8.764000, 8.646000,
> 8.856000, 8.856000, 13.081000, 10.760000, 8.600000, 8.627000,
8.543000,
> 8.762000, 8.627000, 10.146000, 8.547000, 8.518000, 8.518000, 8.856000,
> 8.856000, 8.454000, 8.454000, 8.499000, 8.488000, 8.856000, 8.856000,
> 11.567000, 10.772000, 8.506000, 8.395000, 8.426000, 8.582000,
8.395000,
> 10.144000, 8.407000 ,11.801051, 11.055339, 9.708079, 9.175891,
> 11.216250, 10.219728, 10.075000, 7.859582, 11.470972, 9.162232,
> 10.395510, 10.886422, 11.201043, 11.316806, 9.806960)
>
>
> dat <- data.frame(number=rep(2:9,1,each=9),
> algo=rep(c("one","two","three"),8,each=3),
>                   distance=rep(c("d1","d2","d3"),24), value=a)
>
>
> print(xyplot( value ~ number | algo  , data=dat, groups=distance,
> type="l",
>              auto.key = list(space = "top", points = FALSE, lines =
> TRUE, cex=1.4),
>              layout=c(length(unique(c(dat\$algo)))+1,1),
>              ylab="value", xlab="number", scales = list(cex=1.2)
>              ))
>
> # I will add some grid lines ("ablines") to this plot. To add such
> lines, I must add a panel.grid as argument in the xyplot function and
> also panel.xyplot function.  The following code visualise this, but
now
> the lines are not allocated in the right way.  I have played around
with
> the panel.groups argument of panel.superpose, but without success.

Does type = c("g", "l") do what you want? (It may not if your lattice
is old, but you haven't told us your version.)

Deepayan

```