The command 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.
plot_crop(x, quiet = TRUE)
Filename of the plot.
Whether to suppress standard output from the command.
The original filename.
PDFCrop: https://www.ctan.org/pkg/pdfcrop. If you use
TinyTeX, you may install pdfcrop
with
tinytex::tlmgr_install('pdfcrop')
.