Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Chinese garbled code of matplotlib legend in Ubuntu environment

Shulou Source: shulou.com Published: 2022-06-01 07:14:58 09月30日 Update

The prerequisite for this article is that matplotlib has been installed. As for what matplotlib is and how to install it, this article will not introduce it.

First of all, find the font file of Microsoft Yahei under the Windows area:

Second, find the matplotlab font folder or the system font folder

Matplotlab font library folder

System font library folder

You can copy the font file to either of these two paths.

Then, locate the matplotlib configuration file

You can modify the file directly, or

Then, modify the configuration file.

Edit the configuration file, find font.family, remove the comments, and add the Chinese font Microsoft YaHei in the following font.sans-serif: Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial,Helvetica, Avant Garde, sans-serif.

Finally, clear the cache

After making the above changes, I found that it was of no use.

Delete the file under ~ / .cache / matplotlib and ok it.

Tags: File font configuration library file folder system face Chinese two Chinese font premise copy condition comment cache path Microsoft installed garbled legend Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB MySQL Xiaomi Shulou Information Shulou Technology