数据可视化库——Matplotlib import matplotlib.pyplot as plt 默认可视化操作 plt.plot():画图 plt.show():显示 设置参数 plt.xticks(rotation):变量名倾斜 plt.xlable(‘变量名’):x轴名称 plt.ylabel(‘变量名’):y轴名称 plt.title():标题名称 子图 fig=plt.figure():指定默认画图空间 fig.add_subplot(4,1,x):x代表相对位置 加注释:plt.legend(loc=‘best’) 'best’代表注释框的位置 绘图种类:fig,ax=plt.subplots(),ax是画图的轴,实际画图;fig用来设置参数 柱形图: ax.bar(bar_positions, bar_heights, 0.5),0.5代表柱宽 ax.barh():橫柱形图 散点图:ax.scatter(x, y) 直方图(有bins): ax.hist(y, range(4,5), bins=20),range设置了值的范围 ax.set_ylim(0.5):设置y轴范围 盒图:ax.boxplot()