# plot_crop

0th

Percentile

##### Crop a plot (remove the edges) using PDFCrop or ImageMagick

The program pdfcrop (often shipped with a LaTeX distribution) is executed on a PDF plot file, and magick::image_trim() is executed for other types of plot files.

##### Usage
plot_crop(x, quiet = TRUE)
##### Arguments
x

Filename of the plot.

quiet

Whether to suppress standard output from the command.

##### Details

The program pdfcrop can crop the extra white margins when the plot format is PDF, to make better use of the space in the output document, otherwise we often have to struggle with graphics::par() to set appropriate margins. Note pdfcrop often comes with a LaTeX distribution such as TinyTeX, MiKTeX, or TeX Live, and you may not need to install it separately (use Sys.which('pdfcrop') to check it; if it not empty, you are able to use it). Note that pdfcrop depends on GhostScript. You can check if GhostScript is installed via tools::find_gs_cmd().

##### Value

The original filename.

##### References

PDFCrop: https://www.ctan.org/pkg/pdfcrop. If you use TinyTeX, you may install pdfcrop with tinytex::tlmgr_install('pdfcrop').

##### Aliases
• plot_crop
Documentation reproduced from package knitr, version 1.30, License: GPL

### Community examples

Looks like there are no examples yet.