
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Change Default Font Color for All Text in Matplotlib
To change the default font color for all text in Matplotlib, we can take the following steps −
- Set the figure size and adjust the padding between and around the subplots.
- Using rcParams['text.color'], we can get the default text color.
- We can update the text color and label color after updating the rcParams dict
- Set the title and label of the plot.
- To display the figure, use show() method.
Example
import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True print("Default text color is: ", plt.rcParams['text.color']) plt.rcParams.update({'text.color': "red", 'axes.labelcolor': "green"}) plt.title("Title") plt.xlabel("X-axis") plt.show()
Output
Advertisements