先从网络上下载 SimHei.ttf
文件放在某个位置,然后用下面的代码,设置字体的位置。
1 | import json |
使用
在需要使用中文的地方,指定上面设置好的字体
1 | plt.title("描述长度分布", fontproperties=my_font) |
enjoy!
先从网络上下载 SimHei.ttf
文件放在某个位置,然后用下面的代码,设置字体的位置。
1 | import json |
使用
在需要使用中文的地方,指定上面设置好的字体
1 | plt.title("描述长度分布", fontproperties=my_font) |
enjoy!
原文作者:茄子
原文链接:https://eggplant.wiki/2025/03/08/matplotlib-xian-shi-zhong-wen/
发表日期:March 8th 2025, 4:39:54 pm
更新日期:March 8th 2025, 4:39:54 pm
版权声明:本文采用知识共享署名-非商业性使用 4.0 国际许可协议进行许可