Configure Behavior of the Qt4Agg Backend in Matplotlib



To configure the behaviour of the backend, we can use matplotlib.rcParams['backend'] with a new backend name.

Steps

  • Use get_backend() method to get the backend name.

  • Override the existing backend name using matplotlib.rcParams.

  • Use get_backend() method to get the configured backend name.

Example

import matplotlib
backend = matplotlib.get_backend()
print("The current backend name is: ", backend)
matplotlib.rcParams['backend'] = 'TkAgg'
backend = matplotlib.get_backend()
print("Configured backend name is: ", backend)

Output

The current backend name is: GTK3Agg
Configured backend name is: TkAgg
Updated on: 2021-05-08T09:27:41+05:30

304 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements