Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix matplotlib's param not updated in the first cell #382

Closed
wants to merge 1 commit into from

Conversation

fehiepsi
Copy link

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 call plt.show() in the first cell. I think that somehow, the line matplotlib.pyplot.switch_backend(backend) causes problem. Docs of switch_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 call switch_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 setting matplotlib.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.

@fehiepsi
Copy link
Author

Closed because backend_inline is deprecated.

@fehiepsi fehiepsi closed this Jan 16, 2024
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.

1 participant