How do you determine which backend is being used by matplotlib?

Question:

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?

Asked By: Matthew Rankin

||

Answers:

Use the get_backend() function to obtain a string denoting which backend is in use:

>>> import matplotlib
>>> matplotlib.get_backend()
'TkAgg'
Answered By: Andrew

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
Answered By: Serenity
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.