-
Notifications
You must be signed in to change notification settings - Fork 315
Closed
Labels
Description
First reported at quarto-dev/quarto-cli#6643
---
title: "Label shouldn't be named"
output:
html_document:
dev: svg
---
```{r}
library(gganimate)
```
```{r}
ggplot(mtcars, aes(factor(cyl), mpg)) +
geom_boxplot() +
transition_states(gear)
```Quitting from lines 13-16 [unnamed-chunk-2] (test.Rmd)
Error in `device()`:
! arguments inutilisés (units = "in", res = 192)
Backtrace:
1. rmarkdown::render(...)
2. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
3. knitr:::process_file(text, output)
7. knitr:::process_group.block(group)
8. knitr:::call_block(x)
...
19. knitr (local) value_fun(ev$value, ev$visible)
20. knitr (local) fun(x, options = options)
23. gganimate::knit_print.gganim(x, ...)
26. gganimate:::animate.gganim(...)
28. gganimate (local) `<fn>`(...)
Exécution arrêtée
We see error comes from gganimate itself. Especially here:
Lines 305 to 306 in 7cd46dc
| for (i in seq_along(frames)) { | |
| if (!stream) device(files[i], ...) |
Basically some options are passed to svg() device function and they are not argument of grDevices::svg()
- gganimate does define a
knit_printmethod : https://github.com/thomasp85/gganimate/blob/7cd46dc2bc8cf18c1c81f6ef7fc4d00a1d57a385/R/gganim.R#L36C1-L37 - It will defined some options among which
unitsandreswhen no width or height; Bothunitsandresare in error messageLines 46 to 54 in 7cd46dc
get_knitr_options <- function(options, unlist = TRUE) { opt <- options$gganimate opt$device <- opt$device %||% options$dev if (is.null(opt$width) || is.null(opt$height)) { opt$width <- options$fig.width opt$height <- options$fig.height opt$units <- 'in' opt$res <- options$dpi } - Those options will be passed up to the device used selected in
draw_frames
Lines 285 to 296 in 7cd46dc
device <- switch( device, ragg_png = ragg::agg_png, png = png, jpg = , jpeg = jpeg, tif = , tiff = tiff, bmp = bmp, svg = svg, svglite = svglite::svglite )
res and in are not among svg() arguments
rlang::fn_fmls_names(grDevices::svg)
#> [1] "filename" "width" "height" "pointsize" "onefile"
#> [6] "family" "bg" "antialias" "symbolfamily"Hence the error I believe.