Loading

Seaborn 增加中文支持(Ubuntu)

Ubuntu 中一般会带有若干支持中文的字体,如"AR PL UMing CN"

$ fc-list :lang=zh | grep uming
/usr/share/fonts/truetype/arphic/uming.ttc: AR PL UMing TW MBE:style=Light
/usr/share/fonts/truetype/arphic/uming.ttc: AR PL UMing TW:style=Light
/usr/share/fonts/truetype/arphic/uming.ttc: AR PL UMing CN:style=Light
/usr/share/fonts/truetype/arphic/uming.ttc: AR PL UMing HK:style=Light

也可以选择安装支持中文的字体,如 Mi Sans。

安装了支持了中文的字体后,仅需两行代码,即可使 Seaborn 实现对中文的支持

import seaborn as sns
sns.set(font="MiSans,MiSans Normal")

参考

Ubuntu 安装字体 https://blog.csdn.net/bitcarmanlee/article/details/79729634
Mi Sans 字体 https://web.vip.miui.com/page/info/mio/mio/detail?postId=33935854

posted @ 2022-05-12 21:48  Lambyte  阅读(489)  评论(0)    收藏  举报