Repository navigation
Closed
Description
(Bug checked with cderv) The Rmd example below (except the \ before some triple backticks)(edited) describes a bug/regression introduced in v2.5 (and probably in v2.4) with pdfcrop and fig_crop. In Beamer presentation, the plots are not resized properly anymore in the slide. It is ugly. This is due to the fig_crop: true line in the yaml header. The same ugly slides appear if the line is missing. Currently, the only solution is to write fig_crop: false to get something clean, as in v2.3 and previous versions.
---
title: "A regression in rmarkdown from v_2.3 to v_2.5"
author: "pkR-pkR + cderv"
date: "October 23, 2020"
output:
beamer_presentation:
template: default
latex_engine: pdflatex
keep_tex: true
toc: false
fig_caption: false
fig_crop: true
fontsize: 10pt
---
# A regression in rmarkdown from v_2.3 to v_2.5
A regression in rmarkdown both on Windows and Debian:
- rmarkdown_2.3.tar.gz properly resizes the following plots
- rmarkdown_2.5.tar.gz badly resizes the following plots
The issue occurs/is linked to pdfcrop:
- Missing line **fig_crop** in yaml header => BAD
- **fig_crop: true** in yaml header => BAD
- **fig_crop: false** in yaml header => OK
The current default settings break all previous .Rmd files.
Furthermore, pdfcrop on Windows is very slow.
Please, revert to the previous settings (pdfcrop disabled)!
(Bug reproduced by cderv)
# corrplot::corrplot() => OK with v_2.3, Bad with v_2.5
```{r echo=FALSE, message=FALSE, warning=FALSE}
corrplot::corrplot(matrix(runif(900), 30, 30))
```
# lattice::levelplot() => OK with v_2.3, Bad with v_2.5
```{r echo=FALSE, message=FALSE, warning=FALSE}
lattice::levelplot(matrix(runif(900), 30, 30))
```
By filing an issue to this repo, I promise that
- I have fully read the issue guide at https://yihui.org/issue/.
- I have provided the necessary information about my issue.
- If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
- If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included
xfun::session_info('rmarkdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('rstudio/rmarkdown'). - If I have posted the same issue elsewhere, I have also mentioned it in this issue.
- I have learned the Github Markdown syntax, and formatted my issue correctly.
I understand that my issue may be closed if I don't fulfill my promises.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
yihui commentedon Jan 12, 2022
This was indeed a regression, but should only affect Windows users. In rmarkdown 2.3,
fig_cropwould be set to false on Windows no matter if the cropping tools are available, and would be set to false only if cropping tools are unavailable on other platforms. I don't remember why we made the exception for Windows now (probably becausepdfcropwas buggy or hard to use on Windows), but I feel the exception doesn't make much sense and can cause inconsistent behaviors on different platforms. In v2.5, we removed the exception, and would do cropping as long as the tools are available.Unfortunately, we do not plan to bring back this exception to Windows users. It has been long since we made the previous change. If we revert the change, it may surprise other Windows users again. On the other hand, the fix for this issue appears to be simple enough (i.e., setting
fig_crop: false). Therefore we tend not to make the change in rmarkdown.You described the slides as "ugly". I think it's essentially a matter of figure sizes. You can adjust plot sizes by using the chunk option
out.width, e.g., shrinking the plots byout.width="70%".Apologies for the late response, and thanks for your understanding!
github-actions commentedon Jul 12, 2022
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.