reconverse/incidence2

`plot()` and `facet_plot()` scaling issues due to `interval` and `show_cases = TRUE`

Closed this issue · 2 comments

Please place an "x" in all the boxes that apply

  • I have the most recent version of incidence2 and R
  • I have found a bug
  • I have a reproducible example
  • I want to request a new feature

When using the argument show_cases = TRUE, the image renders incorrectly using the "week" interval.

library(tidyverse)
library(outbreaks)
library(incidence2)

measles_data <- measles_hagelloch_1861 %>%
  tibble()

raw_incidence_week <- incidence(
  measles_data,
  date_of_prodrome,
  interval = "week",
  groups = c(gender, class)
  )

raw_incidence_day <- incidence(
  measles_data,
  date_of_prodrome,
  interval = "day",
  groups = c(gender, class)
  )

# No issues
raw_incidence_day %>%
  plot(
    show_cases = TRUE
  )
#> plot() can only stack/dodge by one variable.
#> For multi-facet plotting try facet_plot()

# Issues
raw_incidence_week %>%
  plot(
    show_cases = TRUE
  )
#> plot() can only stack/dodge by one variable.
#> For multi-facet plotting try facet_plot()

# No issues
raw_incidence_week %>%
  plot(
    show_cases = FALSE
  )
#> plot() can only stack/dodge by one variable.
#> For multi-facet plotting try facet_plot()

Created on 2021-11-23 by the reprex package (v2.0.1)


---------

@arnold-c - Cheers for the report. A little tied up with other work at the moment but will take a look when time permits.

Closing as show_cases is no longer a parameter as of 1ef0420