matplot
1.折线图
import pandas as pd
data=pd.read_csv('/home/he_hui/桌面/shu.csv')
print(data.head(12)) 读取.csv文件的前12个数据
import matplotlib.pyplot as plt
first=data[0:12]
plt.plot(first['1940'],first['124']) 横纵轴 ax1.plot(np.arange(10)*3,np.arange(10),c='red') 可更改线的颜色。
plt.xticks(rotation=45) 横轴标签转换45°
plt.xlabel('years') x轴名称
plt.ylabel('data') y轴名称
plt.title('aaaa') 该图的名称
plt.show()
2.子图操作
import matplotlib.pyplot as plt
fig=plt.figure() // fig=plt.figure(figsize=(a,b)) 可指定所画图的长和宽
ax1=fig.add_subplot(2,2,1)
ax2=fig.add_subplot(2,2,4)
plt.show()
3.条形图和散点图