Skip to content

Commit

Permalink
Use improved syntax for matplotlib >= 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthomas23 authored and Carreau committed Dec 10, 2024
1 parent 56ef444 commit d7df790
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions matplotlib_inline/backend_inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,14 @@ def configure_inline_support(shell, backend):

def _enable_matplotlib_integration():
"""Enable extra IPython matplotlib integration when we are loaded as the matplotlib backend."""
from matplotlib import rcParams
ip = get_ipython()
backend = rcParams._get("backend")

import matplotlib
if matplotlib.__version_info__ >= (3, 10):
backend = matplotlib.get_backend(auto_select=False)
else:
backend = matplotlib.rcParams._get("backend")

if ip and backend in ('inline', 'module://matplotlib_inline.backend_inline'):
from IPython.core.pylabtools import activate_matplotlib
try:
Expand Down

0 comments on commit d7df790

Please sign in to comment.