Using plt.interactive(False) or plt.ioff() in Jupyter (Lab and classic notebook) does not seem to prevent automatic figure generation, unless the magic %matplotlib inline in run first, even though the inline backend is the default.
Example
importmatplotlib.pyplotaspltplt.ioff()
fig, ax=plt.subplots()
a=0
The figure still appears automatically under the cell.

Note that
Explicitly running %matplotlib inline blocks figure creation (even though inline is the default activated backend in Jupyter):

Originally posted in matplotlib/matplotlib#23766
Using
plt.interactive(False)orplt.ioff()in Jupyter (Lab and classic notebook) does not seem to prevent automatic figure generation, unless the magic%matplotlib inlinein run first, even though theinlinebackend is the default.Example
The figure still appears automatically under the cell.

Note that
Explicitly running

%matplotlib inlineblocks figure creation (even though inline is the default activated backend in Jupyter):Originally posted in matplotlib/matplotlib#23766