mpl.rcParams['font.sans-serif'] = ['SimHei'] matplotlib.rcParams['axes.unicode_minus'] = False
时间: 2024-02-03 20:02:34 浏览: 112
Matplotlib不能显示中文 — Font family [‘sans-serif’] not found警告
3星 · 编辑精心推荐
mpl.rcParams\['font.sans-serif'\] = \['SimHei'\]是用于设置Matplotlib图表中的字体为SimHei,SimHei是一种中文字体。\[1\]而matplotlib.rcParams\['axes.unicode_minus'\] = False是用于解决Matplotlib图表中坐标轴负号显示异常的问题。\[2\]这两行代码的作用是确保Matplotlib图表中的中文能够正常显示,并且负号能够正确显示。
#### 引用[.reference_title]
- *1* [Python 之 matplotlib plt.rcParams[]](https://blog.csdn.net/Doris2016/article/details/107698838)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [plt.rcParams(可解决matplotlib无法显示中文和负号的问题)](https://blog.csdn.net/qq_36743284/article/details/123503894)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [plt.rcParams[‘axes.unicode_minus‘] = False #解决保存图像是负号‘ 这句话是什么意思?](https://blog.csdn.net/weixin_54227557/article/details/129651705)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文