How Python modifies fonts in matplotlib
Editor to share with you Python how to modify the font in matplotlib, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
1. Download the necessary support libraries.
Here you need to use the Tab key to select and then press enter to agree.
Sudo apt-get install fontconfigsudo apt install ttf-mscorefonts-installer
Once successful, you can find the newly downloaded Windows font under / usr/share/fonts/truetype/msttcorefonts/.
2. Update the font library and clean up the matplotlib cache.
Sudo fc-cache-fvrm-fr / .cache/matplotlib
After installing fonts, if you do not update the font library, the system will not know that you have new fonts to import matplotlib. Then, the second instruction is to prevent matplotlib from using the old version of the cache to set up your chart at run time. After deletion, running matplotlib automatically creates a new settings cache.
3. After opening Jupyter Notebook to import matplotlib and seaborn, you can use to change the font.
Plt.rcParams ['font.family'] above is all the content of the article "how to modify fonts in matplotlib by Python". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!