ggsave unused argument (filename = filename)
zapster opened this issue · 5 comments
The following code fails with the current ggplot2
and tikzDevice
versions.
library(ggplot2)
df <- data.frame(
gp = factor(rep(letters[1:3], each = 10)),
y = rnorm(30)
)
g <- ggplot(df, aes(gp, y)) + geom_point()
ggsave("plot.pdf", g, device=pdf) # OK
ggsave("plot.tex", g, device=tikzDevice::tikz) # fail
I think the fix for tidyverse/ggplot2#2355 broke tikzDevice
when used with ggsave
. Here is the corresponding commit: tidyverse/ggplot2@a06e904
I don't know whether my issue relates to tikzDevice
as well, but I'm getting the same issue with ggsave unused argument (filename = filename)
after updating to 3.0.0
.
Thanks for the report @zapster!
Are you sure that ggsave("plot.pdf", g, device=pdf)
works correctly? For me it throws the same error message, while ggsave("plot.pdf", g, device="pdf")
or ggsave("plot.png", g, device=png)
work correctly.
BTW, here some background for this issue:
Lines 227 to 229 in 0086e88
Most likely we will update tikz()
to accept both file
and filename
.
Hello @zapster,
latest version 0.12.1 fixes this. You can install it by devtools::install_github("daqana/tikzDevice")
. Thanks for reporting this issue!
Alternative installation method if you already have the dependencies installed:
install.packages("tikzDevice", repo = 'http://www.daqana.org/drat')
General method:
if (!requireNamespace("drat", quietly = TRUE))
install.packages("drat")
drat::addRepo("daqana")
install.packages("tikzDevice")
Thanks for fixing!