library(ggplot2)
library(reshape2)
data1 <- seq(1, 300, 3)
data2 <- seq(1, 100, 0.5)
acf1 <- acf(data1, plot = F, lag.max = 25)
acf2 <- acf(data2, plot = F, lag.max = 25)
df<- data.frame(lag = acf1$lag,acf1=acf1$acf,acf2=acf2$acf)
colnames(df)<-c("lag","data1","data2")
data<-melt(df,id="lag")
ggplot(data, aes(x=lag, y=value)) +
geom_area(aes(colour = variable, fill= variable),position="dodge")
我希望以两种不同的颜色显示两个Acf
值,但我无法弄清楚为什么它只显示一种颜色。我该如何解决这个问题?