jasonhilton / ggfan

Fan plots for plotting distributions in ggplot2
GNU General Public License v2.0
37 stars 5 forks source link

Bug in example from 'Using ggfan to plot a distribution' #9

Closed johnd85 closed 5 years ago

johnd85 commented 5 years ago

Dear Jason,

I am somewhat new to R so please forgive me if the below issue is due to my ignorance.

I have copied the code for the first example in the vignette:

library(ggplot2) library(magrittr) library(tidyr) library(dplyr) library(ggfan)

generate mean and variance for sequence of samples over time

N_time <- 50 N_sims <- 1000 time <- 1:N_time mu <- time2 0.03 + time 0.3 sds <- exp(time2 -0.001 + time 0.1)

simulate 1000 samples from each time point

fake_data <- sapply(time, function(i) rnorm(N_sims, mu[i], sds[i]))

gather into a long-form, tidy dataset

fake_df <- data.frame(x=time, t(fake_data)) %>% gather(key=Sim, value=y, -x) p <- ggplot(fake_df, aes(x=x,y=y)) + geom_interval() print(p)

Attempting to run this, I get the following message:

Don't know how to automatically pick scale for object of type quosure/formula. Defaulting to continuous. Don't know how to automatically pick scale for object of type quosure/formula. Defaulting to continuous. Don't know how to automatically pick scale for object of type quosure/formula. Defaulting to continuous. Error: A continuous variable can not be mapped to linetype

Your package is really cool, would love to get it working! Any help would be greatly appreciated.

Best regards,

John.

jasonhilton commented 5 years ago

Hi John,

Thanks for filing this - I'm glad that you think the package might be useful! I can't see that you are doing anything wrong and if I copy the code above, it seems to work on my machine ok at the moment, so I'm not sure what could be causing this. Just to rule some things out, if possible, could you update all your existing packages, restart R, and try again? Most likely it's something to do with the version of some particular R package that is causing the problem. Additionally, could you post the results of sessionInfo() to help me narrow down the issue?

Thanks, Jason

johnd85 commented 5 years ago

Thanks, will do and will let you know results, unfortunately will likely be tomorrow as travelling and having Wi-Fi issues on laptop!

Best regards,

John.

johnd85 commented 5 years ago

Dear Jason,

I updated my version of R and re-installed all packages, and now code is working perfectly.

Thank you very much for taking the time to help.

Best regards,

John.

jasonhilton commented 5 years ago

Fantastic - let me know if you encounter any other issues. :)