如何更改此图中的以下内容?
Here's the Plot I got from the code source
代码来源:
# Libraries used:
library(ggplot2)
library(timeSeries)
library(ggfortify)
library(ggthemes)
library(dplyr)
library(strucchange)
strucchange::breakpoints(AirPassengers ~ 1) %>%
autoplot(ts.linetype = 'solid', ts.size = 1.1, ts.geom = 'line')+
geom_smooth(aes(y=AirPassengers),
method = "loess", se= F,
lwd = 1.2) +
geom_point(aes(y = AirPassengers), size = 1.5, shape = 16, color = "orange3")+
scale_x_date(date_breaks = "1 years", date_labels = "%Y")+
labs(title = "Yearly Time Series",
subtitle="Sales trend from Year 2001 to 2017",
caption="Source: Airpassengers Time Series Analysis",
y="Sales", x = "Years")+
theme_economist_white()+
theme(axis.text.x = element_text(angle = 90, hjust = -.1))
答案 0 :(得分:0)
可以使用以下语法进行前三个更改:
rewrite ^ $scheme://example.com$uri?from-old=true permanent;
通过在对strucchange::breakpoints(AirPassengers ~ 1) %>%
autoplot(ts.linetype = 'solid', ts.size = 1.1, ts.geom = 'line', fill = "red")+
geom_smooth(aes(y=AirPassengers),
method = "loess", se= F,
lwd = 1.2, color = "green") +
geom_point(aes(y = AirPassengers), size = 1.5, shape = 16, color = "blue")+
scale_x_date(date_breaks = "1 years", date_labels = "%Y")+
labs(title = "Yearly Time Series",
subtitle="Sales trend from Year 2001 to 2017",
caption="Source: Airpassengers Time Series Analysis",
y="Sales", x = "Years")+
theme_economist_white()+
theme(axis.text.x = element_text(angle = 90, hjust = -.1))
的调用中指定color = "green"
来更改趋势线的颜色。对geom_smooth
中的峰值执行相同的操作。最后,在这种情况下,geom_point
似乎不知道autoplot
,但是它可以与指定color
一起使用(这会发出警告,但仍然可以工作)。
我不清楚您希望图例如何显示,您能否在评论中澄清?