我正在尝试更改stl
分解图的构面标签,如下所示:
library(ggplot2)
library(ggfortify)
p <- autoplot(stl(AirPassengers, s.window = 'periodic'), ts.colour = "black", ts.size = 0.2)
p
该图源自ggfortify 包。我希望将构面标签更改为:
c("Original Data", "Seasonal component", "Trend component", "Remainder")
我试图进入一个ggplot
(很多str
'ing)的结构,并发现以下存储这些名称:
str(p$layers[[1]]$data$variable)
# Factor w/ 4 levels "Data","seasonal",..: 1 1 1
但是,当我就地更改此因素时。我得到四个空地块,然后是正确的地块:
p$layers[[1]]$data$variable <- factor(p$layers[[1]]$data$variable,
labels=c("Original series", "Seasonal Component", "Trend component", "Remainder"))
如何更改构面标签而不使这些空图位于顶部?