Skip to content
Back to formatted view

Raw Message

Message-ID: <4D026DAC.6070701@ucalgary.ca>
Date: 2010-12-10T18:13:00Z
From: Peter Ehlers
Subject: overlap different line in a xyplot (lattice)
In-Reply-To: <BAY156-w3AAC96CF0EA9ACD3137FEDF2F0@phx.gbl>

On 2010-12-10 07:04, Francesco Nutini wrote:
>
> dear [R] users,
> is there a way to plot different data (but with the same x-variables) in the same xyplot window?
> There are already a similar question, but the answer is not enought explanatory...

Something like this?

  x <- rep(1:10, 2)
  y1 <- rnorm(10); y2 <- rnorm(10) + 2
  y <- c(y1, y2)
  g <- gl(2, 10)
  xyplot( y ~ x, groups = g, type = 'b')

Peter Ehlers

>
>
> Thanks a lot,
> Francesco
>