MixSIAR
MixSIAR copied to clipboard
Error in UseMethod and Error in grid.Call.graphics
I met a problem when I run the example (cladocera) in the MixSIAR.
output_JAGS(jags.1, mix, source) Error in UseMethod("depth") : no applicable method for 'depth' applied to an object of class "NULL" or Error in grid.Call.graphics(C_upviewport, as.integer(n)) : cannot pop the top-level viewport ('grid' and 'graphics' output mixed?)
As for the first error, when I run my own data, I also got this problem.
I wonder how could I solve this problem. (I use the macOS Monterey system)
I also get this error. Running OSX Monterey with an M1.
> output_JAGS(jags.1, mix, source)
Error in UseMethod("depth") :
no applicable method for 'depth' applied to an object of class "NULL"
In addition: Warning messages:
1: In par(usr) : argument 1 does not name a graphical parameter
2: In par(usr) : argument 1 does not name a graphical parameter
3: In par(usr) : argument 1 does not name a graphical parameter
4: In par(usr) : argument 1 does not name a graphical parameter
5: In par(usr) : argument 1 does not name a graphical parameter
6: In par(usr) : argument 1 does not name a graphical parameter
7: In par(usr) : argument 1 does not name a graphical parameter
8: In par(usr) : argument 1 does not name a graphical parameter
9: In par(usr) : argument 1 does not name a graphical parameter
10: In par(usr) : argument 1 does not name a graphical parameter
I'm using a fresh updated install of R (4.2.2). I installed all packages (except GTK packages) from here.
I get the error running the vignettes using
library(MixSIAR)
mixsiar.dir <- find.package("MixSIAR")
file.path(mixsiar.dir, "example_scripts")
source(file.path(mixsiar.dir, "example_scripts", "mixsiar_script_wolves.R"))
traceback() produces
17: depth(path)
16: upViewport(depth(vp), recording = FALSE)
15: popgrobvp.viewport(x$vp)
14: popgrobvp(x$vp)
13: postDraw.grob(x)
12: postDraw(x)
11: drawGTree(x)
10: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
9: grid.draw.gTree(x$children[[i]], recording = FALSE)
8: grid.draw(x$children[[i]], recording = FALSE)
7: drawGTree(x)
6: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
5: grid.draw.gTree(gtable)
4: grid.draw(gtable)
3: print.ggplot(ggplot2::ggplot(df, ggplot2::aes(x = x, fill = sources,
colour = sources)) + ggplot2::geom_density(alpha = 0.3, ggplot2::aes(y = ..scaled..)) +
ggplot2::xlim(0, 1) + ggplot2::theme_bw() + ggplot2::xlab("Proportion of Diet") +
ggplot2::ylab("Scaled Posterior Density") + ggplot2::labs(title = my.title) +
ggplot2::theme(legend.position = c(1, 1), legend.justification = c(1,
1), legend.title = ggplot2::element_blank()))
2: print(ggplot2::ggplot(df, ggplot2::aes(x = x, fill = sources,
colour = sources)) + ggplot2::geom_density(alpha = 0.3, ggplot2::aes(y = ..scaled..)) +
ggplot2::xlim(0, 1) + ggplot2::theme_bw() + ggplot2::xlab("Proportion of Diet") +
ggplot2::ylab("Scaled Posterior Density") + ggplot2::labs(title = my.title) +
ggplot2::theme(legend.position = c(1, 1), legend.justification = c(1,
1), legend.title = ggplot2::element_blank()))
1: output_JAGS(jags.1, mix, source)
Possibly somewhere around line 292 in output_JAGS.r
EDIT:
Reinstalling using remotes::install_github("brianstock/MixSIAR", dependencies=T)
seems to have eliminated the error. There are still lots of warnings related to ggplot2::aes(y = ..scaled..)
but it ran.
EDIT 2:
After more exploration, the error now appears for the 'killer whale' vignette but not wolves or geese. as above, there are still plenty of warnings related to ggplot.
EDIT 3:
Apparently, it's not related to a specific vignette since it's happening randomly. Seems like it might be related to this old tidyverse issue.
Hello, I have same problem with OSX Ventura and I upgrade Mac OS and I run the MixSIAR but I have same error like you mentioned above.Traceback() produce same. I remove all Rstudio and Xquarz and reseal all again but there is still problem. Do you know any solution on this error. if you have any idea, it will be very helpful.
I'm also running on MacOS and having this issue in RStudio and base R even after reinstalling the package per @jhoviatt 's suggestions. I noticed this error occurs when running any of the vignettes or my own data with any fixed or random effects. When I remove fixed/random effects for my data or run the "killer whale" vignette, for example, which has no fixed or random effects output_JAGS() works with no errors. What's frustrating, as noted by others, is that the error appears to be related to the ggplot objects, but it is preventing output of the summary statistics and diagnostics (for me at least) of the model...