matplotlib工具的使用
首先需要安装matplotlib
sudo pip3.5 install matplotlib
下面是源码
#!/usr/local/bin/python3.5
#-*- coding:utf-8 -*-
import matplotlib.pyplot as plt
y = [1, 0, 2, 5, 224, 732, 1129, 1223, 1241, 1274, 1396, 1670, 2063, 2516, 2991, 3521, 3972, 4174, 4076, 4030, 3531, 2916, 2301, 1740, 1187, 758, 556, 328, 199, 114, 55, 32, 23, 12, 5, 3, 0, 1]
x = [20*i for i in range(len(y))]
plt.plot(x, y, "r-", linewidth=2)
plt.ylabel('count')
plt.xlabel('score')
plt.grid(True)
plt.title("User's Score")
plt.show()
下面是画出来的图形
image.png
利用python进行简单的画图还是非常方便的