Move draw_if_interactive logic to new_figure_manager_given_figure. #468
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, Matplotlib only ever calls draw_if_interactive at the end of
plt.figure()
(and upon figure unpickling), i.e. this is a mechanism tofurther customize handling of newly generated figures. (Prior to
Matplotlib 1.5, draw_if_interactive was also called at the end of all
pyplot functions to trigger a figure redraw, but this is now handled by
the stale attribute.)
In order to simplify the backend API ("what is the API that a backend
module must/can provide", I am planning to deprecate (on Matplotlib's
side) the ability for backends to provide a draw_if_interactive
function (forcing them to always do
if interactive(): draw_idle()
) (matplotlib/matplotlib#23105).Instead, any relevant new-figure-customization logic can instead go
into
new_figure_manager_given_figure
. This PR implements this changefor ipympl, and should be fully back-compatible all the way back to
Matplotlib 1.5. I would like to make these changes first on the side
of the clients (i.e., the third-party backends), to catch any possible
problems with the intended change on Matplotlib's side.