0

I'm generating a fair bit of plots with matplotlib for my document. For consistent white space between plots, images, etc. I'd like to crop the plot images which are pgf to the extents of the plot "ink". Is there a nice way, preferable outside the generated pgf environment? I feel like adjustbox would be the way to go, but I could not find what I was looking for in the manual.

  • TikZ/pgf keeps track of the bounding box by default (unless you switch it off e.g. with overlay). The resulting bounding boxes are accurate except for Bezier curves, see https://tex.stackexchange.com/q/43621/194703. The answers to this question provide means of making the bounding box accurate. If I understood correctly, the currently inofficial bbox library will, probably in a modified form, become part of pgf v3.1.5. –  Nov 22 '19 at 19:45
  • adjustbox has no knowledge about the "ink" in its content just about the official size. have a look on the pdfcrop executable. You could also use Ghostscript to calculate the bounding box of a PDF and use that as clipping size. It would be possible to automate this in a package code, but I would rather think it should be part of standalone package not adjustbox. – Martin Scharrer Aug 28 '20 at 07:20

0 Answers0