Created
January 22, 2026 00:26
-
-
Save alexlenail/c58929365ec324bd3e16ed214e86b726 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pathlib import Path | |
| from IPython.display import display, Markdown | |
| def save_and_display_fig(fig, output_stem): | |
| output_stem = Path(output_stem) | |
| output_stem.parent.mkdir(parents=True, exist_ok=True) | |
| fig.savefig(output_stem.with_suffix(".pdf"), bbox_inches="tight") | |
| fig.savefig(output_stem.with_suffix(".svg"), bbox_inches="tight") | |
| plt.close(fig) | |
| display(Markdown(f"})")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment