Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 719
Matthew Rankin Avatar asked Aug 26 '10 22:08

Matthew Rankin


People also ask

How do I check my matplotlib backend?

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.

What backend does matplotlib use?

Matplotlib is a plotting library. It relies on some backend to actually render the plots. The default backend is the agg backend.


2 Answers

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

>>> import matplotlib >>> matplotlib.get_backend() 'TkAgg' 
like image 156
Andrew Avatar answered Sep 25 '22 23:09

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 
like image 33
Serenity Avatar answered Sep 26 '22 23:09

Serenity