Closed
Description
If I understood the method correctly, tight_bbox causes a figure to be printed to a in-memory buffer first, determines the bounding box of the figure contents and saves a new figure shrunk to the extent of the contents. Right?
Tight_bbox seems to have trouble figuring out the bounding box of a PDF created with latex using the pgf backend. This example produces a PNG and a PDF to be clipped with tight_bbox (make sure you are using the current master). The PNG is clipped correctly, the bounding box of the PDF is estimated incorrectly however.
import matplotlib as mpl
mpl.use('pgf')
import matplotlib.pyplot as plt
plt.figure()
plt.plot(range(5), markersize=2, marker='x')
plt.savefig('test.pdf', bbox_inches='tight')
plt.savefig('test.png', bbox_inches='tight')
I don't know exactly how tight_bbox works, or why it doesn't just calculate the figure's extent in the same way tight_layout solves that issue instead.
Metadata
Metadata
Assignees
Labels
No labels