-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to plot to PNG #79
Comments
Am I getting some sort of package interference, similar to #78 ? I'm not getting the error message seen there. But, if I make a function inside my package like so: ` writeManovaPNG2 <- function(thePngFile) And from an R sesssion from the command line (not in RStudion), call that function with a good path, as seen below, I don't get an error like #78 (beyond the warning about unable to close base device, which is expected). But I do get a pop-up PNG plotting what I expect. (MBatch is the name of my package.) But the PNG is empty. `> library(MBatch)
` R session info is:
Matrix products: default locale: attached base packages: other attached packages: loaded via a namespace (and not attached): I can also reproduce it outside my package with the same results, from a fresh R --vanilla session:
|
Session info for the vanilla command line session.
Matrix products: default locale: attached base packages: other attached packages: loaded via a namespace (and not attached): |
Unless you're loading gplots, you shouldn't be having any interference. I think the problem is that you're using |
No gplots -- so that's good. Can you try my code? library(Cairo) The on.exit doesn't make any difference-it fails within a function regardless. But on.exit is required for proper use, since if there is a problem with permissions or the network drive goes down, without the on.exit, it leaks the file pointer, since an error in plot will throw an exception and skip the dev.off call. |
Ah, now I know what the issue is. You need to call writeManovaPNG4 <- function() {
library(Cairo)
library(eulerr)
CairoPNG(file = "tmp2.png")
three_inside_fourth <- euler(c("A" = 30,
"A&B" = 3, "A&C" = 3, "A&D" = 3,
"A&B&C" = 2, "A&B&D" = 2, "A&C&D" = 2,
"A&B&C&D" = 1))
print(plot(three_inside_fourth))
dev.off()
}
writeManovaPNG4()
#> png
#> 2 Created on 2020-12-20 by the reprex package (v0.3.0) |
This is not specific to eulerr, by the way, this is the case with almost all implementations of grid-based plotting, including ggplot2 and lattice. |
I am unable to plot an Euler diagram to PNG (or PDF or JPEG or TIFF). Other plot functions work fine, such as using one of the example calls to the basic plot. Plot for Euler Diagrams will plot the diagram to the RStudio preview. But for files, the resulting PNG is plain black -- nothing was written to it.
Code to reproduce (taken from example). Set thePngFile to a value path.
` CairoPNG(file = thePngFile)
on.exit(dev.off())
three_inside_fourth <- euler(c("A" = 30,
"A&B" = 3, "A&C" = 3, "A&D" = 3,
"A&B&C" = 2, "A&B&D" = 2, "A&C&D" = 2,
"A&B&C&D" = 1))
plot(three_inside_fourth)`
The text was updated successfully, but these errors were encountered: