如何在X轴上显示R中预测值的日期标签?

时间:2016-08-01 17:48:46

标签: r plot prediction forecasting axis-labels

我们已使用forecast函数预测未来值,如下所示:

library("zoo")
library("forecast")
Lines = "20/03/2014,9996792524
21/04/2014,8479115468
21/09/2014,11394750532
16/10/2014,9594869828
18/11/2014,10850291677
08/12/2014,10475635302
22/01/2015,10116010939
26/02/2015,11206949341
20/03/2015,11975140317
09/04/2015,11526960332
29/04/2015,9986194500
16/09/2015,11501088256
13/10/2015,11833183163
10/11/2015,13246940910
16/12/2015,13255698568
27/01/2016,13775653990
23/02/2016,13567323648
22/03/2016,14607415705
11/04/2016,13835444224
04/04/2016,14118970743"
z <- read.zoo(text = Lines, sep = ",", header = TRUE, index = 1:1, tz = "", format = "%d/%m/%Y")
x <- ts(z,f=4)
fit <- ts(rowSums(tsSmooth(StructTS(x))[,-2]))
tsp(fit) <- tsp(x)
plot(x)
lines(fit,col=2)
fit
fcst <- forecast(fit)
plot(fcst)

但是,情节fcst不会在x轴上显示时间/日期标签,而只显示通用数字1,2,3 ...

enter image description here

要了解预测值,我们需要x轴上的月度日期标签。我们应该怎么做?

0 个答案:

没有答案