教你解决Python数据分析可视化时可以显示中文
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
![](https://devpress.csdnimg.cn/6deffb34f7114cc1a2e1e686a67e0027.png)
·
问题描述:
使用Python进行数据分析时,中文是显示不了的,
那么怎么使matplotlib可视化是能够显示中文呢?
你需要具备的知识:matplotlib基本操作,linux基本操作,IPython
解决方法如下:
# 解决中文显示问题
# 先安装中文字体,命令如下
sudo apt install ttf-wqy-microhei
#在cell中编写代码
import matplotlib.pyplot as plt
import matplotlib as mpl
zhfont=mpl.font_manager.FontProperties(fname='/usr/share/fonts/truetype/wqy/wqy-microhei.ttc')
plt.plot([1, 2, 3])
plt.xlabel('x轴标签', fontproperties=zhfont,fontsize=20)
# plt.show()
如果你是windows环境,就使用windows的中文字体即可
![]( https://profile-avatar.csdnimg.cn/default.jpg)
![](https://devpress.csdnimg.cn/7174e1ca86c447029bb12f9ec0bd281c.png)
![](https://devpress.csdnimg.cn/096f7827187446559bd7b6030eb5db38.png)
![](https://devpress.csdnimg.cn/6deffb34f7114cc1a2e1e686a67e0027.png)
A beautiful web dashboard for Linux
最近提交(Master分支:5 个月前 )
186a802e
added ecosystem file for PM2 4 年前
5def40a3
Add host customization support for the NodeJS version 4 年前
更多推荐
所有评论(0)