import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams['font.family'] = ['sans-serif']
plt.rcParams['font.sans-serif'] = ['SimHei']
date=np.loadtxt("D:\\Project\\09-18年度数据.csv",delimiter=",",unpack=True,dtype='str')
xindex=np.arange(10)
x=date[1:,0]
y1=list(map(float,date[1:,3]))
y2=list(map(float,date[1:,4]))
y3=list(map(float,date[1:,5]))
bar_width=0.3
plt.bar(xindex,y1,bar_width,color='b',label='第一产业')
plt.bar(xindex+0.3,y2,bar_width,color='r',label='第二产业')
plt.bar(xindex+0.3+0.3,y3,bar_width,color='g',label='第三产业')
plt.xticks(xindex+0.3,x)
plt.legend()
plt.show()