Issue
Hello everyone I am trying to save the figures from matplotlib. It saves with blank spaces around the figure, I mean It adds space, It is no saved with ajusted object size. It is very easy to edit them in Inkscape (I make that in this software), but that's not nice when there are more than 50 figures. I do that because in beamer slides a figure with extra space occupies a lot of space, because of the sheet it is very small.
Solution
Use constrained layout in:
plt.figure
function
# 3.5.3 and 3.6
fig = plt.figure(figsize=(8, 6), layout="constrained")
fig.add_subplot()
plt.plot([1, 2], [3, 4])
plt.subplots
function
# 3.5.3 and 3.6
fig, ax = plt.subplots(figsize=(8, 6), layout="constrained")
ax.plot([1, 2], [3, 4])
Set layout on Figure object, after its creation:
# 3.5.3
fig.set_constrained_layout(True)
# 3.6
fig.set_layout_engine("constrained")
More info:
Answered By - Joao_PS
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.