Please review matplotlib: Tight Layout guide and try using matplotlib.pyplot.tight_layout
, or matplotlib.figure.Figure.tight_layout
As a quick example:
import matplotlib.pyplot as plt
fig, axes = plt.subplots(nrows=4, ncols=4, figsize=(8, 8))
fig.tight_layout() # Or equivalently, "plt.tight_layout()"
plt.show()
Without Tight Layout
With Tight Layout