Skip to content

Commit

Permalink
Save figures with tight bbox (#703)
Browse files Browse the repository at this point in the history
Fits the image bbox to the content to avoid unnecessary blank space.
Enabled globally to work with `--save_plot` and with the save button
of the matplotlib Qt / Tk GUI canvas.

Closes #701
  • Loading branch information
MichaelGrupp authored Oct 31, 2024
1 parent 2cad4fd commit 55fa03f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion evo/tools/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def apply_settings(settings: SettingsContainer = SETTINGS):
# https://matplotlib.org/stable/users/explain/axes/constrainedlayout_guide.html
"figure.constrained_layout.use": True,
"font.family": settings.plot_fontfamily,
"pgf.texsystem": settings.plot_texsystem
"pgf.texsystem": settings.plot_texsystem,
"savefig.bbox": "tight",
})
if "xkcd" in settings:
plt.xkcd()
Expand Down

0 comments on commit 55fa03f

Please sign in to comment.