Skip to content

Commit

Permalink
Fixed issue with autoplot() and length 1 forecasts
Browse files Browse the repository at this point in the history
Resolves #400
  • Loading branch information
mitchelloharawild committed May 13, 2024
1 parent 9918b60 commit 6865b67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# fabletools (development version)

## Bug fixes

* Fixed issue with `autoplot()` and length 1 forecasts (#400).

# fabletools 0.4.2

Minor patch to build package with latest R version as requested by CRAN.
Expand Down
4 changes: 2 additions & 2 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,15 @@ build_fbl_layer <- function(object, data = NULL, level = c(80, 95),
out[[length(out) + 1L]] <- ggdist::geom_lineribbon(without(intvl_mapping, "colour_ramp"), data = dist_qi_frame(object[single_row[["FALSE"]],], level), ..., inherit.aes = FALSE, key_glyph = draw_key_ribbon)
}
if(length(single_row[["TRUE"]]) > 0) {
out[[length(out) + 1L]] <- ggdist::stat_interval(intvl_mapping, data = dist_qi_frame(object[single_row[["TRUE"]],], level), ..., inherit.aes = FALSE, key_glyph = draw_key_ribbon)
out[[length(out) + 1L]] <- ggdist::geom_interval(intvl_mapping, data = dist_qi_frame(object[single_row[["TRUE"]],], level), orientation = "vertical", ..., inherit.aes = FALSE, key_glyph = draw_key_ribbon)
}
out[[length(out) + 1L]] <- ggplot2::labs(fill = col_nm)
} else {
if(length(single_row[["FALSE"]]) > 0) {
out[[length(out) + 1L]] <- ggdist::geom_lineribbon(without(intvl_mapping, "colour_ramp"), data = dist_qi_frame(object[single_row[["FALSE"]],], level), fill = colour, ..., inherit.aes = FALSE, key_glyph = draw_key_ribbon)
}
if(length(single_row[["TRUE"]]) > 0) {
out[[length(out) + 1L]] <- ggdist::stat_interval(intvl_mapping, data = dist_qi_frame(object[single_row[["TRUE"]],], level), colour = colour, ..., inherit.aes = FALSE, key_glyph = draw_key_ribbon)
out[[length(out) + 1L]] <- ggdist::geom_interval(intvl_mapping, data = dist_qi_frame(object[single_row[["TRUE"]],], level), colour = colour, orientation = "vertical", ..., inherit.aes = FALSE, key_glyph = draw_key_ribbon)
}
}

Expand Down

0 comments on commit 6865b67

Please sign in to comment.