Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of all available matplotlib backends

The current backend name is accessible via

 >>> import matplotlib.pyplot as plt >>> plt.get_backend() 'GTKAgg' 

Is there a way to get a list of all backends that can be used on a particular machine?

like image 986
Alexander Gromnitsky Avatar asked Feb 23 '11 14:02

Alexander Gromnitsky


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 are matplotlib backends?

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

What is default matplotlib backend?

In modern matplotlib there is no "default backend", i.e. the rcParams['backend'] is set to a "sentinel". Upon importing matplotlib the first working backend from a candidate list ["macosx", "qt5agg", "qt4agg", "gtk3agg", "tkagg", "wxagg"] is chosen.


1 Answers

You can access the lists

matplotlib.rcsetup.interactive_bk matplotlib.rcsetup.non_interactive_bk matplotlib.rcsetup.all_backends 

the third being the concatenation of the former two. If I read the source code correctly, those lists are hard-coded though, and don't tell you what backends are actually usable. There is also

matplotlib.rcsetup.validate_backend(name) 

but this also only checks against the hard-coded list.

like image 144
Sven Marnach Avatar answered Sep 26 '22 01:09

Sven Marnach