1% Generated by roxygen2: do not edit by hand 2% Please edit documentation in R/plot.R 3\name{plot_crop} 4\alias{plot_crop} 5\title{Crop a plot (remove the edges) using PDFCrop or ImageMagick} 6\usage{ 7plot_crop(x, quiet = TRUE) 8} 9\arguments{ 10\item{x}{Filename of the plot.} 11 12\item{quiet}{Whether to suppress standard output from the command.} 13} 14\value{ 15The original filename. 16} 17\description{ 18The program \command{pdfcrop} (often shipped with a LaTeX distribution) is 19executed on a PDF plot file, and 20\code{magick::\link[magick:transform]{image_trim}()} is executed for other 21types of plot files. 22} 23\details{ 24The program \command{pdfcrop} can crop the extra white margins when the plot 25format is PDF, to make better use of the space in the output document, 26otherwise we often have to struggle with \code{graphics::\link{par}()} to set 27appropriate margins. Note \command{pdfcrop} often comes with a LaTeX 28distribution such as TinyTeX, MiKTeX, or TeX Live, and you may not need to 29install it separately (use \code{Sys.which('pdfcrop')} to check it; if it not 30empty, you are able to use it). Note that \command{pdfcrop} depends on 31GhostScript. You can check if GhostScript is installed via 32\code{tools::find_gs_cmd()}. 33} 34\references{ 35PDFCrop: \url{https://www.ctan.org/pkg/pdfcrop}. If you use 36 TinyTeX, you may install \command{pdfcrop} with 37 \code{tinytex::tlmgr_install('pdfcrop')}. 38} 39