If you are using Unix or Mac OS, another option when the various field options are not trimmed enough is to use the pdfcrop command, available on Unix via R , to invoke system commands:
# after saving image, run pdfcrop system2(command = "pdfcrop", args = c("name_or_path_of_file_before_crop.pdf", "name_or_path_of_file_after_crop.pdf") )
For more details see: https://robjhyndman.com/hyndsight/crop-r-figures/
source share