For normal plots or subplots, the tight_layout command does a pretty good job of keeping things from overlapping, and managing the bounding box of the overall figure.
However, if you have plot with insets etc. then tight_layout can throw a tantrum. Something like: "ValueError: max() arg is an empty sequence".
For such plots, if your axis label gets cut, and you don't want to push the label too close to the axis with something like:
ax1.xaxis.labelpad = -10
then, you can use the bbox_inches = "tight" flag when saving your figure to ensure your axis labels are not clipped.
plt.savefig('xyz.pdf', bbox_inches = "tight")
However, if you have plot with insets etc. then tight_layout can throw a tantrum. Something like: "ValueError: max() arg is an empty sequence".
For such plots, if your axis label gets cut, and you don't want to push the label too close to the axis with something like:
ax1.xaxis.labelpad = -10
then, you can use the bbox_inches = "tight" flag when saving your figure to ensure your axis labels are not clipped.
plt.savefig('xyz.pdf', bbox_inches = "tight")
No comments:
Post a Comment