- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I set the 'backend' in matplotlib in Python?
We can use matplotlib.rcParams['backend'] to override the backend value.
Steps
Using get_backend() method, return the name of the current backend, i.e., default name.
Now override the backend name.
Using get_backend() method, return the name of the current backend, i.e., updated name.
Example
import matplotlib print("Before, Backend used by matplotlib is: ", matplotlib.get_backend()) matplotlib.rcParams['backend'] = 'TkAgg' print("After, Backend used by matplotlib is: ", matplotlib.get_backend())
Output
Before, Backend used by matplotlib is: GTK3Agg After, Backend used by matplotlib is: TkAgg
Advertisements