reconhub / incidence

☣:chart_with_upwards_trend::chart_with_downwards_trend:☣ Compute and visualise incidence
https://reconhub.github.io/incidence
Other
58 stars 13 forks source link

plot result incorrect #122

Closed angryjinyan closed 4 years ago

angryjinyan commented 4 years ago

I followed the instructions on https://www.repidemicsconsortium.org/incidence/ with the following code: `library(outbreaks) library(ggplot2) library(incidence)

dat <- ebola_sim$linelist$date_of_onset class(dat)

head(dat) i.7 <- incidence(dat, interval = 7) i.7 plot(i.7)`

The desired output should be image

However, I get a plot like this: image

And also a warning message: position_stack requires non-overlapping x intervals

I have no idea what's happened. Is this something this library need to fix or I'm getting some libraries' version wrong?

zkamvar commented 4 years ago

This was reported in #119 and was found to be caused by the new version of ggplot2 (there is an issue open for this over there). A workaround centering the dates on the bars has been added to the current GitHub version, but it hasn't yet been submitted to CRAN.

zkamvar commented 4 years ago

You can install the most recent version with remotes::install_github("reconhub/incidence")

angryjinyan commented 4 years ago

Thanks for the help! After installed the latest version, it works now!

zkamvar commented 4 years ago

I'll try to get the patch up to github soon!

zkamvar commented 4 years ago

Note: this will be fixed when ggplot2 3.3.2 comes out (see #126)