incidence2 icon indicating copy to clipboard operation
incidence2 copied to clipboard

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

Open arnold-c opened this issue 3 years ago • 1 comments
trafficstars

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

  • [x] I have the most recent version of incidence2 and R
  • [x] I have found a bug
  • [x] 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 avatar Nov 23 '21 15:11 arnold-c

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

TimTaylor avatar Dec 08 '21 01:12 TimTaylor

Closing as show_cases is no longer a parameter as of https://github.com/reconverse/incidence2/commit/1ef0420a031462eb252d69046fd6fc8f8f1b6c82

TimTaylor avatar Jan 24 '23 15:01 TimTaylor