Skip to content
Prev 306055 / 398506 Next

efficient overlapping average curve on original curves

And with ggplot2.


library(ggplot2)
library(scales)

dat <- data.frame(id = seq_len(nrow(mat)), mat)
dm <- reshape2::melt(dat, id = "id")
dm$variable <- as.ordered(dm$variable)
dm$avg <- rowMeans(mat)

p <- ggplot(dm, aes(x = id, y = value, group = variable))
p + geom_line(data = dm, colour = alpha("blue", 1/5)) +
     geom_line(data = dm, aes(y = avg), colour = "darkblue")

Rui Barradas
Em 22-09-2012 02:02, arun escreveu: