Skip to content

gg_season() shows wrong values on x-axis #107

@karabanb

Description

@karabanb

When I try plot examples from with fpp3 book with gg_season (without period argument) plots has unwanted and wrong years on x-axis.

All examples with declared period argument works well.

library(fpp3)

a10 <- PBS %>% 
  filter(ATC2=='A10') %>% 
  select(Month, Concession, Type, Cost) %>% 
  summarise(TotalC = sum(Cost)) %>% 
  mutate(Cost = TotalC/1e6)

a10 %>% 
  gg_season(Cost, labels = 'both') +
  ylab('$ milion') +
  ggtitle('Seasonal plot: antidiabetic drug sales')

example

sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.5

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/pl_PL.UTF-8

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
 [1] fable_0.2.1       feasts_0.1.4      fabletools_0.2.0  tsibbledata_0.2.0 tsibble_0.9.1    
 [6] ggplot2_3.3.2     lubridate_1.7.9   tidyr_1.1.0       dplyr_1.0.0       tibble_3.0.1     
[11] fpp3_0.3         

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6         pillar_1.4.4         compiler_4.0.0       tools_4.0.0         
 [5] digest_0.6.25        lifecycle_0.2.0      gtable_0.3.0         anytime_0.3.7       
 [9] pkgconfig_2.0.3      rlang_0.4.6          cli_2.0.2            rstudioapi_0.11     
[13] xfun_0.15            withr_2.2.0          generics_0.0.2       vctrs_0.3.1         
[17] hms_0.5.3            grid_4.0.0           tidyselect_1.1.0     glue_1.4.1          
[21] R6_2.4.1             fansi_0.4.1          distributional_0.1.0 farver_2.0.3        
[25] readr_1.3.1          purrr_0.3.4          magrittr_1.5         scales_1.1.1        
[29] ellipsis_0.3.1       assertthat_0.2.1     colorspace_1.4-1     renv_0.10.0         
[33] labeling_0.3         utf8_1.1.4           tinytex_0.24         munsell_0.5.0       
[37] crayon_1.3.4

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions