I'd like my script to automatically change the backend back to "inline" when it is run by Jupiter.
I tried this but it does not work (in practice) :
# If the script is not run by python but by jupyter and is using a different backend then "inline"
if matplotlib.get_backend() != 'Qt5Agg' and ( 'inline' not in matplotlib.get_backend() ) :
print("=> BEFORE: matplotlib backend = <%s>" % matplotlib.get_backend() )
matplotlib.use('module://ipykernel.pylab.backend_inline',warn=False, force=True) # <=> %matplotlib inline
import matplotlib.pyplot as plt
print("=> AFTER: matplotlib backend = <%s>" % matplotlib.get_backend() )
Hi,
I'd like my script to automatically change the backend back to "inline" when it is run by Jupiter.
I tried this but it does not work (in practice) :
I get this (which theoretically is correct) :
But in practice, the "inline" backend is not applied.
Can you help me ?