1. 首页
  2. 数据库
  3. 其它
  4. 在matplotlib的图中设置中文标签的方法

在matplotlib的图中设置中文标签的方法

上传者: 2020-12-30 06:14:19上传 PDF文件 37.93KB 热度 10次
其实就是通过 FontProperties来设置的,请参考以下代码: import matplotlib.pyplot as plt from matplotlib.font_manager import FontProperties font = FontProperties(fname=r"c:\windows\fonts\msyh.ttc", size=15) plt.title("散点图练习", fontproperties=font) plt.scatter([1, 2, 3, 4, 5, 6], [2, 3, 4, 6, 9, 12]) plt.xlabel('横坐标', fon
下载地址
用户评论