我写了这段代码:
duom=read.delim("clipboard",header=TRUE)
dim(duom)
duom
Duom=ts(duom,start=2000,freq=4)
dLT=diff(Duom[,3])
dLT
plot(dLT)
abline(0,0)
dLT
LT<-decompose(dLT)$trend
plot(decompose(dLT)$trend)
abline(0,0)
dLV=diff(Duom[,2])
dLV
plot(dLV)
abline(0,0)
dLV
LV<-decompose(dLV)$trend
plot(decompose(dLV)$trend)
abline(0,0)
dEE=diff(Duom[,1])
dEE
plot(dEE)
abline(0,0)
dEE
EE<-decompose(dEE)$trend
plot(decompose(dEE)$trend)
abline(0,0)
所以我得到了三个不同的LT,LV和EE图。我想将它们组合成一个单独的图像(曲线的颜色应该不同),我该怎么做?
答案 0 :(得分:0)
一些模拟数据:
data = ts(replicate(3, cumsum(rnorm(1000))), freq = 4, start = 2000)
dec = decompose(data)
ylim = range(dec$trend, na.rm = TRUE)
plot(dec$trend[, 1], ylim = ylim)
for(i in 2:ncol(dec$trend))
lines(dec$trend[, i], col = i)
abline(0, 0, col = 'darkgray')
希望它有所帮助!