import matplotlib.pyplot as plt
import matplotlib.pylab as pylab
import numpy as npdef draw_bar(self, labels, quants):width = 0.8ind = np.linspace(1, 66, 65)# 绘图参数全家桶params = {'axes.labelsize': '16','xtick.labelsize': '16','ytick.labelsize': '13','lines.linewidth': '2','legend.fontsize': '20','figure.figsize': '26, 24'  # set figure size}pylab.rcParams.update(params)# make a square figurefig = plt.figure(1)ax = fig.add_subplot(111)# Bar Plot#横的柱状图ax.barh(ind - width / 2, quants, width, color='blue')#竖的柱状图#ax.bar(ind - width / 2, quants, width, color='blue')# Set the ticks on x-axisax.set_yticks(ind)ax.set_yticklabels(labels)#竖的柱状图#ax.set_xticks(ind)#ax.set_xticklabels(labels)# labelsax.set_xlabel('xxx')ax.set_ylabel('xxxxxxxx')# titleax.set_title('xxxxxxxxxxxxx')plt.grid(True)#也可以这样设置图片大小#plt.figure(figsize=())#plt.show()plt.savefig("bar.jpg")plt.close()