Skip to content Skip to sidebar Skip to footer

Ipython Automatically Turning On Matplotlib Interactive Mode

I'm experiencing some newly odd behavior from IPython. I just had to do a clean reinstall of my miniconda, so I now have fresh IPython and Matplotlib versions. It turns out that IP

Solution 1:

It's a bug in the interplay between matplotlib and IPython, which got introduced in matplotlib version 3.1.0 (via #12637). It will be fixed in matplotlib 3.2 (via #14979).

Options you have:

Solution 2:

A workaround for this version of ipython/matplotlib would be to define a custom ioff():

import matplotlib.pyplot as plt
import matplotlib as mpl

def my_ioff():
  f = plt.figure()
  plt.close(f)
  plt.ioff()

my_ioff()
print(mpl.is_interactive())
f = plt.figure()
print(mpl.is_interactive())
-----------
-> False
-> False

Whereas before we had:

plt.ioff()
print(mpl.is_interactive())
f = plt.figure()
print(mpl.is_interactive())
-----------
-> False
-> True

Post a Comment for "Ipython Automatically Turning On Matplotlib Interactive Mode"