我有 1000 条每周行为路径(从 1 到 52 周)。
我希望直观地探索数据。
显然,如果我只是将它全部绘制出来,它看起来就像一个巨大的混乱 - 我想知道是否有一种巧妙的方法来为图表设置动画,比如它循环通过 100 个左右的帐户并随着每条新线的增加而一个一个地构建图表一种明显的颜色,然后在我们进入下一行时被遮蔽。本质上是向某人展示非常混乱的图表的构建。
这是一些示例代码,可生成下面的嘈杂图表。
#####
library(ggplot2)
for (i in 1:100){
mydf <- cbind(seq(1:52),paste('record_',i,sep=''),data.frame(rnorm(n=52, mean=10, sd=1)))
names(mydf) <- c('week_number','record_id','spend')
if (i==1) {
mydfFull<-mydf
} else {
mydfFull <- rbind(mydf,mydfFull)
}
}
# plot the sample
ggplot(data=mydfFull, aes(x=week_number, y=spend, group=record_id, colour=record_id)) + geom_line() + theme(legend.position="none")
#####
我想我想为这个图表的构建逐行设置动画。
我发现有一个动画包,我也认为 GoogleVis 可能有用。
任何人对什么可能是一个好方法有任何经验或建议?