長い形式でデータを取得する、p
p <- structure(list(plot = c(4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L), time = c(1986, 1987, 1998, 2010, 1986, 1987, 1998, 2010,
1986, 1987, 1998, 2010), id = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L), variable = structure(c(1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 3L, 3L, 3L, 3L), .Label = c("ABBA", "PIRU", "BECO"), class = "factor"),
value = c(0.557407905350901, NaN, 0.316510695187166, 0.301356485920244,
0.213498252218338, NaN, 0.17028743315508, 0.180391321330919,
0.0244689432643184, NaN, 0.0217245989304813, 0.020595859522034
)), .Names = c("plot", "time", "id", "variable", "value"), row.names = c(NA,
-12L), class = "data.frame")
それをプロットします:
ggplot(p, aes(x=time, y=value, fill=variable)) + geom_area()