-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
widget: be more permissive in backend names
- Loading branch information
1 parent
8e927e5
commit 6d06752
Showing
4 changed files
with
23 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
def check_widget_backend(): | ||
import matplotlib.pyplot as plt | ||
|
||
if not max( | ||
# Note: Some, but not all versions of matplotlib lower the backend names. Hence, we | ||
# always lower them to be on the safe side. | ||
[backend in plt.get_backend().lower() for backend in ("nbagg", "ipympl", "widget")] | ||
): | ||
raise RuntimeError( | ||
( | ||
"Please enable an interactive matplotlib backend for this widget to work. In " | ||
"jupyter notebook or lab you can do this by invoking either " | ||
"%matplotlib widget or %matplotlib ipympl. Please note that you may have to " | ||
"restart the notebook kernel for this to work." | ||
), | ||
) |
This file contains 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
This file contains 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