首页
Java
登录
6mi
u
盘
搜
搜 索
Java
python matplotlib 图形中添加中文
python matplotlib 图形中添加中文
xiaoxiao
2021-04-16
78
主要参考链接: Python 中,matplotlib绘图无法显示中文的问题
matplotlib 无法显示中文,主要原因是没有中文字体库,可以如下添加中文注释
import
matplotlib
.
pyplot
as
plt
# 添加中文字体
import
matplotlib
as
mpl mpl
.
rcParams
[
'font.sans-serif'
]
=
[
'SimHei'
]
# 使用 plt.annotate 添加注释的方式显示中文
plt
.
annotate
(
u
'叶子'
,
(
x
,
y
)
)
# x,y 为坐标值
转载请注明原文地址: https://www.6miu.com/read-4818141.html
技术
最新回复
(
0
)