Skip to content
Prev 106681 / 398525 Next

lattice xyplot: plot multiple lines with different colors

Try this:


library(lattice)
x <- 1:10

xyplot(x/max(x) ~ x, type = "n", col = "blue", ylim = 0:1)
for(i in 1:3) {
	trellis.focus("panel", 1, 1)
	panel.lines(x, x^i/max(x^i), col = i)
	trellis.unfocus()
}
On 12/28/06, Bram Kuijper <a.l.w.kuijper at rug.nl> wrote: