How to Change Fonts in matplotlib?
In this article, we will see how can we can change the font family of our graph using matplotlib. A variety of fonts are in fact supported by matplotlib, alone has to do in order to implement is pass the name as value to fontname parameter.
- Import required library.
- Create data
- Set changed font
- Normally plot the data
- Display plot
Example 1: Change the font just for the axis labels.
Example 2: Change the font just for the title.
Example 3: Change the font just for the title and axis labels.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course