| plot_forecast_generic | R Documentation |
Model-agnostic plotly plotting: works off just ds/yhat(+intervals)
for models that only produce that, and additionally draws Prophet's
trend/holiday/changepoint decomposition when forecast_df still has
those columns (pass the adapter's raw forecast() output for that; pass
the standardized to_tibble() output to metrics functions instead).
plot_forecast_generic(
forecast_df,
train_df = NULL,
model_obj = NULL,
subtitle = NULL,
title = "Forecast",
show_trend = TRUE,
show_uncertainty = TRUE,
show_holidays = FALSE,
show_changepoints = FALSE,
max_marker_lines = 60,
color_actual = "#1b9e77",
color_forecast = "#d95f02",
color_trend = "#7570b3",
color_ci = "#1b9e77"
)
forecast_df |
A tibble with |
train_df |
Optional tibble with |
model_obj |
Optional fitted model object; only used to read
|
subtitle |
Optional character scalar, e.g. an ARIMA/SARIMA
|
title |
Character scalar, the plot title. Default |
show_trend, show_uncertainty, show_holidays, show_changepoints |
Logical toggles for each optional layer. |
max_marker_lines |
Integer cap on how many holiday/changepoint marker lines are drawn (evenly subsampled beyond this), so a long horizon with recurring holidays doesn't render as unreadable clutter. |
color_actual, color_forecast, color_trend, color_ci |
Hex color strings for each line/ribbon. |
A plotly htmlwidget.
ds <- as.Date("2024-01-01") + 0:9
forecast_df <- tibble::tibble(ds = ds, yhat = 1:10)
plot_forecast_generic(forecast_df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.