Skip to content

ggsave() can't be used with devices taking file as argument instead of filename #3807

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

Closed
bwiernik opened this issue Feb 7, 2020 · 0 comments · Fixed by #3810
Closed

ggsave() can't be used with devices taking file as argument instead of filename #3807

bwiernik opened this issue Feb 7, 2020 · 0 comments · Fixed by #3810

Comments

@bwiernik
Copy link
Contributor

bwiernik commented Feb 7, 2020

In ggsave(), if device is specified and the device takes the file argument instead of filename, ggsave fails with an error: unused argument (filename = filename)

library(ggplot)
p <- qplot(cars[[1]], cars[[2]])
ggsave("plot.pdf", p, device = pdf)

For the grDevices devices that take file, ggsave customizes the call to use file instead, but this doesn't work for devices from other packages, such as devEMF::emf or Cairo::CairoSVG.

This appears to be caused by these changes to remove partial argument matching.
#2355
#2364

It would be nice if ggsave automatically caught this error, then retried with file instead of filename.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant