Skip to content
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

Figure cropped without warning #1365

Closed
qifei9 opened this issue Feb 23, 2017 · 4 comments
Closed

Figure cropped without warning #1365

qifei9 opened this issue Feb 23, 2017 · 4 comments
Labels
doc Need to improve documentation
Milestone

Comments

@qifei9
Copy link

qifei9 commented Feb 23, 2017

When render Rmd to pdf, the figures are cropped by default. The EPS figures are in bad quality (no longer vector graphics?) after cropped by ImageMagick and there is no warning about this.

@yihui
Copy link
Owner

yihui commented Feb 23, 2017

That is a decision made in rmarkdown. If you do not want this feature, you can turn it off by fig_crop = FALSE, e.g.

output:
  pdf_document:
    fig_crop: false

That said... Seriously? Are there still journals that require EPS figures?... 😂

@qifei9
Copy link
Author

qifei9 commented Feb 24, 2017

Problem

I found this option of rmd. This option is mentioned in the rmarkdown reference guide and in http://rmarkdown.rstudio.com/pdf_document_format.html#figure_options. However, neither of these two documents warn about the impairment to EPS figures.

The problem is that, when user use dev option like postscript or cario_ps, he will get low quality figures and no clue about why the figure quality is impaired. It may be very hard to connect the impairment to fig_crop option.

For myself, I spent rather long time to find out why EPS figure is in low quality. Finally I found with dev='CairoPS', the figure is OK. This is due to a bug #1364 about the filename of the figure. I notice a warning like convert cannot open file xxx. Then I wondered what is convert. I read the code of knitr/R/plot.R, found the code about crop and finally point the impairment to fig_crop.

The fig_crop is true by default, so I think at least a warning should be given in the document or printed when render. Then users can finger out how to get high quality EPS figures.

EPS vs PDF

When manager the figures under git. If you store figures in PDF, every time you render the rmd file, git will mark the figures as modified even there is no change in the figures. If the figures are stored in EPS format, there is no problem. git can read the figures and know the figures are not changed.

Perhaps this issue should be reported in rmarkdown repo?

@yihui
Copy link
Owner

yihui commented Feb 25, 2017

I'm very sorry for wasting your time. I think we should definitely mention the problem with cropping eps figures in the rmarkdown documentation.

It is indeed tricky to deal with binary files in git. Usually I try to avoid committing binary files into git, such as images generated from R (I ignore them in .gitignore). I understand that this may not be an option for you if you are collaborating with other people, though.

yihui added a commit to rstudio/rmarkdown that referenced this issue Feb 25, 2017
@yihui yihui closed this as completed Mar 6, 2017
@yihui yihui added this to the v1.16 milestone Mar 6, 2017
@yihui yihui added the doc Need to improve documentation label Mar 6, 2017
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
doc Need to improve documentation
Projects
None yet
Development

No branches or pull requests

2 participants