Fix matplotlib's param not updated in the first cell #382
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.
Background
#264 is made to remove the necessity of
plt.show()
. However, it causes various problems as reported at #295, jupyter/notebook#3385, ipython/ipython#11098. In addition, even with #264, we need to callplt.show()
in the first cell. I think that somehow, the line matplotlib.pyplot.switch_backend(backend) causes problem. Docs ofswitch_backend
method says that "Switching to an interactive backend is possible only if no event loop for another interactive backend has started. Switching to and from non-interactive backends is always possible." As I understand, we should not callswitch_backend
two times in the same cell (even if we have the same backend).This PR tries to solve above problems by not calling
activate_matplotlib(backend)
but only settingmatplotlib.interactive(True)
in_enable_matplotlib_integration()
method.The result works well in my system. RCparams are updated in the first cell. In addition, we don't need to call
plt.show
in the first cell.