-
-
Notifications
You must be signed in to change notification settings - Fork 972
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
Can't save plot in Rmarkdown #2510
Comments
You saving to Did you try |
I don't really know about the error. I suspect this is something with how the IDE is handling Graphic device. You file should be written to disk though and working. FYI knitr is already saving plot to file when you do ```{r}
plot(x = 0:10, y = 10:20)
``` You can control which devices to use and how it is saved using figures options (https://yihui.org/knitr/options/#plots). So you should report the warning in RStudio IDE repo if you only sees it in the IDE when interactively rendering. I don't see what can be done in rmarkdown regarding this. |
I has encountered a strange problem, and search it for many days: can't save plot to pdf or png file in interactive Rmarkdown.
This is the minimal example:
When I use "command+enter" run directly those code in Rmarkdown, the plot will show inline under the code, but doesn't save to file.
dev.off()
would show Error:Error in dev.off() : cannot shut down device 1 (the null device)
"test.pdf" file has been generated, but when I open it, it shows “The file content is corrupted”.
By the way, 1. when using knit to render the output file, "test.pdf" will be generated correctly, 2. ggsave function works in interactive way mentioned above.
xfun::session_info('rmarkdown')
The text was updated successfully, but these errors were encountered: