数据处理Matplotlib - 01

Matplotlib 是一款2D绘图库,只要给出符合格式的数据,通过Matplotlib 就可以方便的绘制出折线图,柱状图,散点图等。

1.安装

2.测试代码

import matplotlib.pyplot as plt

# 定义2个列表分别作为X轴、Y轴数据
x_data = ['2011', '2012', '2013', '2014', '2015', '2016', '2017']
y_data = [58000, 60200, 63000, 71000, 84000, 90500, 107000]

# 第一个列表代表横座标的值,第二个代表纵座标的值
plt.plot(x_data, y_data)
#plt.plot(y_data)
# 调用show()函数显示图形
plt.show()

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章