Slide 32
Slide 32 text
4.レポート作成
(続き)
#ggplot
p ggplot(df_for_plot) +
# geoms
geom_ribbon(aes(x = start_date, ymin = yhat_lower, ymax = yhat_upper),
fill = "#0000ff33") +
geom_line(aes(x = start_date, y = yhat), color = "#0000ffaa") +
geom_point(aes(x = start_date, y = y, color = outliers),
show.legend = FALSE, na.rm = TRUE) +
# scales
scale_x_date(date_breaks = "1 month", date_labels = "%Y/%m") +
scale_y_continuous(labels = if (!decimal) scales comma else waiver()) +
scale_color_manual(values = c("red", "black", "blue", "gray")) +
# labels and themes
theme_bw() +
labs(title = plot_title, subtitle = subtitle_text,
caption = "点 実測値 実線 帯 予測値 \n将来8週間 予測 \n日
x = "", y = "")
# output
p
}
32 / 40