Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How Python modifies fonts in matplotlib

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report