可视化——matplotlib常见api(四)

来源:互联网 发布:网红店经济模式知乎 编辑:程序博客网 时间:2024/06/05 04:31

plt.xticks()

第一个参数接受坐标,第二个参数接受,各坐标显示的文本,关键字参数,如 rotation,表示文本显示时旋转的角度,为了达到一种美观的效果。



import matplotlib.pyplot as pltimport numpy as npif __name__ == '__main__':    data = [5840, 5704, 5754, 5431, 5322, 2392, 3225, 5296, 5488, 5713, 5542, 5928, 2848, 3048, 5216,            5072, 5480, 5832, 4816, 2748, 2536, 5384, 5288, 5928, 5896, 5952, 2792, 2600, 5000, 4704]    plt.plot(data)    width = 1.    plt.xticks(np.arange(len(data))+width/2, ['9/'+str(i) for i in range(1, 31)], rotation=60)    plt.show()

绘图基本选项


这里写图片描述
这里写图片描述
这里写图片描述

0 0
原创粉丝点击