FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Expose `close_figure_after_save` in `superanimal_analyze_images()` by maximpavliv · Pull Request #3082 · DeepLabCut/DeepLabCut · GitHub

Expose close_figure_after_save in superanimal_analyze_images() - #3082

Merged
AlexEMG merged 35 commits into
mainfrom
maxim/expose_close_figure_after_save
Sep 10, 2025
Merged

Expose close_figure_after_save in superanimal_analyze_images()#3082
AlexEMG merged 35 commits into
mainfrom
maxim/expose_close_figure_after_save

Conversation

maximpavliv commented Sep 1, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

Description:

This PR exposes the close_figure_after_save parameter in superanimal_analyze_images() and sets its default value to True. This ensures that figures are closed after being saved, preventing matplotlib from issuing warnings when many figures are created in sequence.

To preserve interactive visualization in tutorials, the COLAB_YOURDATA_SuperAnimal.ipynb notebook has been updated to explicitly set close_figure_after_save=False.

Motivation:

A user reported on the forum that they encounter:

RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (matplotlib.pyplot.figure) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam figure.max_open_warning). Consider using matplotlib.pyplot.close().

By default, figures are now closed automatically after saving, suppressing this warning. Users who want to keep figures open (e.g., in notebooks) can set close_figure_after_save=False.

Copy link
Copy Markdown
Contributor Author

You were right @AlexEMG , the close_figure_after_save parameter in superanimal_analyze_images() was originally set to False for its usage in the COLAB_YOURDATA_SuperAnimal.ipynb notebook! Therefore I changed the default to True, and added close_figure_after_save=False in the notebook.

AlexEMG commented Sep 10, 2025

Copy link
Copy Markdown
Member

Excellent!

AlexEMG merged commit c098ce0 into main Sep 10, 2025
5 checks passed
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL