Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in adding multiple fables via autolayer #414

Closed
robjhyndman opened this issue Feb 4, 2025 · 1 comment
Closed

Error in adding multiple fables via autolayer #414

robjhyndman opened this issue Feb 4, 2025 · 1 comment

Comments

@robjhyndman
Copy link
Member

library(fpp3)
#> Registered S3 method overwritten by 'tsibble':
#>   method               from 
#>   as_tibble.grouped_df dplyr
#> ── Attaching packages ─────────────────────────────────────── fpp3 1.0.1.9000 ──
#> ✔ tibble      3.2.1          ✔ tsibble     1.1.6     
#> ✔ dplyr       1.1.4          ✔ tsibbledata 0.4.1.9000
#> ✔ tidyr       1.3.1          ✔ feasts      0.4.1.9000
#> ✔ lubridate   1.9.4          ✔ fable       0.4.1.9000
#> ✔ ggplot2     3.5.1
#> ── Conflicts ───────────────────────────────────────────────── fpp3_conflicts ──
#> ✖ lubridate::date()    masks base::date()
#> ✖ dplyr::filter()      masks stats::filter()
#> ✖ tsibble::intersect() masks base::intersect()
#> ✖ tsibble::interval()  masks lubridate::interval()
#> ✖ dplyr::lag()         masks stats::lag()
#> ✖ tsibble::setdiff()   masks base::setdiff()
#> ✖ tsibble::union()     masks base::union()
jan_vic_elec <- vic_elec |>
  filter(yearmonth(Time) == yearmonth("2014 Jan")) |>
  index_by(Date = as_date(Time)) |>
  summarise(Demand = sum(Demand), Temperature = max(Temperature))

fit <- jan_vic_elec |>
  model(TSLM(Demand ~ Temperature))

next_day_cold <- new_data(jan_vic_elec, 1) |>
  mutate(Temperature = 15)
f_cold <- fit |>
  forecast(next_day_cold) |>
  mutate(Scenario = "Cold day") |>
  as_fable(key = Scenario)

next_day_hot <- new_data(jan_vic_elec, 1) |>
  mutate(Temperature = 35)
f_hot <- fit |>
  forecast(next_day_hot) |>
  mutate(Scenario = "Hot day") |>
  as_fable(key = Scenario)

jan_vic_elec |>
  autoplot(Demand) +
  autolayer(bind_rows(f_cold, f_hot))
#> Error in `fill_alpha()`:
#> ! fill must be a vector of colours or list of <GridPattern> objects.

Created on 2025-02-04 with reprex v2.1.1

@mitchelloharawild
Copy link
Member

Fixed, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants