Either interactively, such as from within an Ipython session, or from within a script, how can you determine which backend is being used by matplotlib?
To check that pylab/pyplot backend of Matplotlib runs inline, we can use get_backend() method. The method returns the name of the current backend.
Matplotlib is a plotting library. It relies on some backend to actually render the plots. The default backend is the agg backend.
Use the get_backend()
function to obtain a string denoting which backend is in use:
>>> import matplotlib >>> matplotlib.get_backend() 'TkAgg'
Another way to determine the current backend is to read rcParams
dictionary:
>>> import matplotlib >>> print (matplotlib.rcParams['backend']) MacOSX >>> matplotlib.use('agg') >>> print (matplotlib.rcParams['backend']) agg
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With