Open
Description
This was reported in
Previously, with 0.24.0, this would produce two recorded plot
ev <- evaluate::evaluate(function() {
hist(cars$speed)
hist(cars$speed, breaks = "Scott")
})
lapply(ev, class)
#> [[1]]
#> [1] "source"
#>
#> [[2]]
#> [1] "recordedplot"
#>
#> [[3]]
#> [1] "source"
#>
#> [[4]]
#> [1] "recordedplot"
packageVersion("evaluate")
#> [1] '0.24.0'
and knitr would be responsible to keep only one or all depending on fig.keep
options
> md <- glue::glue("
```{r}
hist(cars$speed)
hist(cars$speed, breaks = 'Scott')
```
", .open = "{{", .close = "}}")
> knitr::knit(text = md) |> cat()
1/1 [unnamed-chunk-1]
``` r
hist(cars$speed)
hist(cars$speed, breaks = 'Scott')
```

> knitr::opts_chunk$set(fig.keep="all")
> knitr::knit(text = md) |> cat()
1/1 [unnamed-chunk-1]
``` r
hist(cars$speed)
```

``` r
hist(cars$speed, breaks = 'Scott')
```

However, with evaluate 1.0.0, there is now a new logic to detect different plots
evaluate::evaluate(function() {
hist(cars$speed)
hist(cars$speed, breaks = "Scott")
})
#> <evaluation>
#> Source code:
#> hist(cars$speed)
#> Plot [7]:
#> <base> C_plot_new()
#> <base> palette2()
#> <base> C_plot_window()
#> <base> C_title()
#> <base> C_axis()
#> <base> C_axis()
#> <base> C_rect()
#> Source code:
#> hist(cars$speed, breaks = "Scott")
So fig.keep = 'all'
does not have the effect as there is no second plot to keep now.
Is this change expected?
Or could it be something to check when this was rewritten ?
Lines 62 to 69 in 1c4492b
Metadata
Metadata
Assignees
Labels
No labels