- Trending Categories
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 do you change the 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
- Related Articles
- How to change the text color of font in the legend using Matplotlib?
- Change the default background color for Matplotlib plots
- How to change the font color of a text using JavaScript?
- Changing the Default Font for all the widgets in Tkinter
- How do I change the font size of the scale in Matplotlib plots?
- How to change the default path for "save the figure" in Matplotlib?
- How to change text font in HTML?
- How to change text font for JLabel with HTML in Java?
- How to change font color of textView in android?
- How to change the background color of the font in PowerShell?
- How to set font face, style, size and color for JTextPane text in Java
- How to change autopct text color to be white in a pie chart in Matplotlib?
- How do I change the axis tick font in a Matplotlib plot when rendering using LaTeX?
- How to change the font and color on the UITextView in iOS?
- How to change the Foreground color or Font color of the console using PowerShell?

Advertisements