#图I1 样本中的土地流转情况 图I1a面积占比
import matplotlib.pyplot as plt
import numpy as np
# 设置中文字体
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
labels = ['2014', '2015', '2016', '2017', '2018']
one = [23.60565, 26.07236, 29.97162, 32.68684, 39.90594]
two = [6.566172, 7.473643, 9.31609, 10.34889, 11.95687]
three = [17.03948, 18.59872, 20.65553, 22.33795, 27.94907]
x = np.arange(len(labels)) # 标签位置
width = 0.20 # 柱状图宽度
fig, ax = plt.subplots()
rects1 = ax.bar(x - width * 0.60, one, width, label='农地流转比例', hatch='...', color='w', edgecolor='k')
rects2 = ax.bar(x + width * 0.60, two, width, label='农地转出比例', hatch='***', color='w', edgecolor='k')
rects3 = ax.bar(x + width * 1.80, three, width, label='农地转入比例', hatch='//', color='w', edgecolor='k')
ax.set_ylabel('百分比 %')
ax.set_xticks(x)
plt.ylim(0, 45)
ax.set_xticklabels(labels, rotation=0)
# 在每个柱状图的顶部添加数字标注
def autolabel(rects):
for rect in rects:
height = rect.get_height()
ax.annotate('{:.1f}'.format(height), # 格式化字符串,保留一位小数
xy=(rect.get_x() + rect.get_width() / 2, height),
xytext=(0, 3), # 3 points vertical offset
textcoords="offset points",
ha='center', va='bottom')
autolabel(rects1)
autolabel(rects2)
autolabel(rects3)
fig.tight_layout()
# 将图例放在底部
# 将图例放在底部
ax.legend(loc='lower center', bbox_to_anchor=(0.5, -0.2), ncol=3)
plt.savefig("land.png", dpi=750, bbox_inches='tight')
plt.show()
#图I1 样本中的土地流转情况 图I1b 农户数占比
import matplotlib.pyplot as plt
import numpy as np
# 设置中文字体
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
labels = ['2014', '2015', '2016', '2017', '2018']
one = [21.9193, 26.3904, 32.06107, 36.09597, 41.11232]
two = [12.86805, 15.3217, 19.02944, 21.4831, 24.42748]
three = [9.814613, 11.83206, 14.39477, 16.08506, 18.81134]
x = np.arange(len(labels)) # 标签位置
width = 0.20 # 柱状图宽度
fig, ax = plt.subplots()
rects1 = ax.bar(x - width * 0.60, one, width, label='农户流转比例', hatch='...', color='w', edgecolor='k')
rects2 = ax.bar(x + width * 0.60, two, width, label='农户转出比例', hatch='***', color='w', edgecolor='k')
rects3 = ax.bar(x + width * 1.80, three, width, label='农户转入比例', hatch='//', color='w', edgecolor='k')
ax.set_ylabel('百分比 %')
ax.set_xticks(x)
plt.ylim(0, 45)
ax.set_xticklabels(labels, rotation=0)
# 在每个柱状图的顶部添加数字标注
def autolabel(rects):
for rect in rects:
height = rect.get_height()
ax.annotate('{:.1f}'.format(height), # 格式化字符串,保留一位小数
xy=(rect.get_x() + rect.get_width() / 2, height),
xytext=(0, 3), # 3 points vertical offset
textcoords="offset points",
ha='center', va='bottom')
autolabel(rects1)
autolabel(rects2)
autolabel(rects3)
fig.tight_layout()
# 将图例放在底部
# 将图例放在底部
ax.legend(loc='lower center', bbox_to_anchor=(0.5, -0.2), ncol=3)
plt.savefig("land_nhlz.png", dpi=750, bbox_inches='tight')
plt.show()
##图I1 样本中的土地流转情况 图I1c地块数占比
import matplotlib.pyplot as plt
import numpy as np
# 设置中文字体
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
labels = ['2014', '2015', '2016', '2017', '2018']
one = [12.5, 14.80155, 18.37152, 20.79583, 24.47831]
two = [7.262684, 8.469722, 10.2189, 11.62029, 13.08306]
three = [ 5.237316, 6.331833, 8.152618, 9.175532, 11.39525]
x = np.arange(len(labels)) # 标签位置
width = 0.20 # 柱状图宽度
fig, ax = plt.subplots()
rects1 = ax.bar(x - width * 0.60, one, width, label='农户流转比例', hatch='...', color='w', edgecolor='k')
rects2 = ax.bar(x + width * 0.60, two, width, label='农户转出比例', hatch='***', color='w', edgecolor='k')
rects3 = ax.bar(x + width * 1.80, three, width, label='农户转入比例', hatch='//', color='w', edgecolor='k')
ax.set_ylabel('百分比 %')
ax.set_xticks(x)
plt.ylim(0, 45)
ax.set_xticklabels(labels, rotation=0)
# 在每个柱状图的顶部添加数字标注
def autolabel(rects):
for rect in rects:
height = rect.get_height()
ax.annotate('{:.1f}'.format(height), # 格式化字符串,保留一位小数
xy=(rect.get_x() + rect.get_width() / 2, height),
xytext=(0, 3), # 3 points vertical offset
textcoords="offset points",
ha='center', va='bottom')
autolabel(rects1)
autolabel(rects2)
autolabel(rects3)
fig.tight_layout()
# 将图例放在底部
# 将图例放在底部
ax.legend(loc='lower center', bbox_to_anchor=(0.5, -0.2), ncol=3)
plt.savefig("land_nhlz.png", dpi=750, bbox_inches='tight')
plt.show()
##图I2 土地流转中的正式与非正式流转 图I2a 面积占比
import matplotlib.pyplot as plt
import numpy as np
# 设置中文字体
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
labels = ['2014', '2015', '2016', '2017', '2018']
one = [23.60565, 26.07236, 29.97162, 32.68684, 39.90594]
two = [20.97803, 23.05348, 26.5668, 28.97878, 35.69223]
three = [2.627627, 3.018879, 3.404818,3.708072,4.213709]
x = np.arange(len(labels)) # 标签位置
width = 0.20 # 柱状图宽度
fig, ax = plt.subplots()
rects1 = ax.bar(x - width * 0.60, one, width, label='农地流转比例', hatch='...', color='w', edgecolor='k')
rects2 = ax.bar(x + width * 0.60, two, width, label='正式流转比例(租金)', hatch='***', color='w', edgecolor='k')
rects3 = ax.bar(x + width * 1.80, three, width, label='非正式流转比例(零租金)', hatch='//', color='w', edgecolor='k')
ax.set_ylabel('百分比 %')
ax.set_xticks(x)
plt.ylim(0, 45)
ax.set_xticklabels(labels, rotation=0)
# 在每个柱状图的顶部添加数字标注
def autolabel(rects):
for rect in rects:
height = rect.get_height()
ax.annotate('{:.1f}'.format(height), # 格式化字符串,保留一位小数
xy=(rect.get_x() + rect.get_width() / 2, height),
xytext=(0, 3), # 3 points vertical offset
textcoords="offset points",
ha='center', va='bottom')
autolabel(rects1)
autolabel(rects2)
autolabel(rects3)
fig.tight_layout()
# 将图例放在底部
# 将图例放在底部
ax.legend(loc='lower center', bbox_to_anchor=(0.5, -0.2), ncol=3)
plt.savefig("land_zjarea.png", dpi=750, bbox_inches='tight')
plt.show()
##图I2 土地流转中的正式与非正式流转 图I2b 农户数占比
import matplotlib.pyplot as plt
import numpy as np
# 设置中文字体
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
labels = ['2014', '2015', '2016', '2017', '2018']
one = [21.9193, 26.3904, 32.06107, 36.09597, 41.11232]
two = [12.92257, 15.5398, 19.90185, 22.73719, 26.33588]
three = [9.760087, 11.77754, 13.52236, 14.94002, 17.012]
x = np.arange(len(labels)) # 标签位置
width = 0.20 # 柱状图宽度
fig, ax = plt.subplots()
rects1 = ax.bar(x - width * 0.60, one, width, label='农户流转比例', hatch='...', color='w', edgecolor='k')
rects2 = ax.bar(x + width * 0.60, two, width, label='农户正式流转比例(租金)', hatch='***', color='w', edgecolor='k')
rects3 = ax.bar(x + width * 1.80, three, width, label='农户非正式流转比例(零租金)', hatch='//', color='w', edgecolor='k')
ax.set_ylabel('百分比 %')
ax.set_xticks(x)
plt.ylim(0, 45)
ax.set_xticklabels(labels, rotation=0)
# 在每个柱状图的顶部添加数字标注
def autolabel(rects):
for rect in rects:
height = rect.get_height()
ax.annotate('{:.1f}'.format(height), # 格式化字符串,保留一位小数
xy=(rect.get_x() + rect.get_width() / 2, height),
xytext=(0, 3), # 3 points vertical offset
textcoords="offset points",
ha='center', va='bottom')
autolabel(rects1)
autolabel(rects2)
autolabel(rects3)
fig.tight_layout()
# 将图例放在底部
# 将图例放在底部
ax.legend(loc='lower center', bbox_to_anchor=(0.5, -0.2), ncol=3)
plt.savefig("land_nhzjlz.png", dpi=750, bbox_inches='tight')
plt.show()
##图I2 土地流转中的正式与非正式流转 图I2c 地块数占比
import matplotlib.pyplot as plt
import numpy as np
# 设置中文字体
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
labels = ['2014', '2015', '2016', '2017', '2018']
one = [12.5, 14.80155 , 18.37152, 20.79583, 24.47831]
two = [7.385434, 8.827742, 11.37479, 13.01146, 15.69149]
three = [5.114566, 5.973814, 6.996727,7.78437, 8.786825]
x = np.arange(len(labels)) # 标签位置
width = 0.20 # 柱状图宽度
fig, ax = plt.subplots()
rects1 = ax.bar(x - width * 0.60, one, width, label='农地流转比例', hatch='...', color='w', edgecolor='k')
rects2 = ax.bar(x + width * 0.60, two, width, label='正式流转比例(租金)', hatch='***', color='w', edgecolor='k')
rects3 = ax.bar(x + width * 1.80, three, width, label='非正式流转比例(零租金)', hatch='//', color='w', edgecolor='k')
ax.set_ylabel('百分比 %')
ax.set_xticks(x)
plt.ylim(0, 45)
ax.set_xticklabels(labels, rotation=0)
# 在每个柱状图的顶部添加数字标注
def autolabel(rects):
for rect in rects:
height = rect.get_height()
ax.annotate('{:.1f}'.format(height), # 格式化字符串,保留一位小数
xy=(rect.get_x() + rect.get_width() / 2, height),
xytext=(0, 3), # 3 points vertical offset
textcoords="offset points",
ha='center', va='bottom')
autolabel(rects1)
autolabel(rects2)
autolabel(rects3)
fig.tight_layout()
# 将图例放在底部
# 将图例放在底部
ax.legend(loc='lower center', bbox_to_anchor=(0.5, -0.2), ncol=3)
plt.savefig("land_zujin.png", dpi=750, bbox_inches='tight')
plt.show()
## 图I3 土地流转中的正式与非正式流转(交易对象) a面积占比
import matplotlib.pyplot as plt
import numpy as np
# 设置中文字体
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
labels = ['2014', '2015', '2016', '2017', '2018']
one = [23.60565, 26.07236, 29.97162, 32.68684, 39.90594]
two = [9.495009, 9.890385, 10.67644 , 11.81726, 12.99995]
three = [14.11064, 16.18198, 19.29519, 20.86959, 26.90599]
x = np.arange(len(labels)) # 标签位置
width = 0.20 # 柱状图宽度
fig, ax = plt.subplots()
rects1 = ax.bar(x - width * 0.60, one, width, label='农户流转比例', hatch='...', color='w', edgecolor='k')
rects2 = ax.bar(x + width * 0.60, two, width, label='农户正式流转比例(非熟人)', hatch='***', color='w', edgecolor='k')
rects3 = ax.bar(x + width * 1.80, three, width, label='农户非正式流转比例(熟人)', hatch='//', color='w', edgecolor='k')
ax.set_ylabel('百分比 %')
ax.set_xticks(x)
plt.ylim(0, 45)
ax.set_xticklabels(labels, rotation=0)
# 在每个柱状图的顶部添加数字标注
def autolabel(rects):
for rect in rects:
height = rect.get_height()
ax.annotate('{:.1f}'.format(height), # 格式化字符串,保留一位小数
xy=(rect.get_x() + rect.get_width() / 2, height),
xytext=(0, 3), # 3 points vertical offset
textcoords="offset points",
ha='center', va='bottom')
autolabel(rects1)
autolabel(rects2)
autolabel(rects3)
fig.tight_layout()
# 将图例放在底部
# 将图例放在底部
ax.legend(loc='lower center', bbox_to_anchor=(0.5, -0.2), ncol=3)
plt.savefig("land_nhdxlz.png", dpi=750, bbox_inches='tight')
plt.show()
## 图I3 土地流转中的正式与非正式流转(交易对象) b农户数占比
import matplotlib.pyplot as plt
import numpy as np
# 设置中文字体
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
labels = ['2014', '2015', '2016', '2017', '2018']
one = [21.9193, 26.3904, 32.06107, 36.09597, 41.11232]
two = [5.016358, 5.834242, 7.251908, 8.451472, 10.08724]
three = [17.33915, 21.04689, 25.84515,28.89858, 32.87895]
x = np.arange(len(labels)) # 标签位置
width = 0.20 # 柱状图宽度
fig, ax = plt.subplots()
rects1 = ax.bar(x - width * 0.60, one, width, label='农地流转比例', hatch='...', color='w', edgecolor='k')
rects2 = ax.bar(x + width * 0.60, two, width, label='正式流转比例(非熟人)', hatch='***', color='w', edgecolor='k')
rects3 = ax.bar(x + width * 1.80, three, width, label='非正式流转比例(熟人)', hatch='//', color='w', edgecolor='k')
ax.set_ylabel('百分比 %')
ax.set_xticks(x)
plt.ylim(0, 45)
ax.set_xticklabels(labels, rotation=0)
# 在每个柱状图的顶部添加数字标注
def autolabel(rects):
for rect in rects:
height = rect.get_height()
ax.annotate('{:.1f}'.format(height), # 格式化字符串,保留一位小数
xy=(rect.get_x() + rect.get_width() / 2, height),
xytext=(0, 3), # 3 points vertical offset
textcoords="offset points",
ha='center', va='bottom')
autolabel(rects1)
autolabel(rects2)
autolabel(rects3)
fig.tight_layout()
# 将图例放在底部
# 将图例放在底部
ax.legend(loc='lower center', bbox_to_anchor=(0.5, -0.2), ncol=3)
plt.savefig("land_dxarea.png", dpi=750, bbox_inches='tight')
plt.show()
## 图I3 土地流转中的正式与非正式流转(交易对象) c地块数占比
import matplotlib.pyplot as plt
import numpy as np
# 设置中文字体
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
labels = ['2014', '2015', '2016', '2017', '2018']
one = [12.5, 14.80155, 18.37152, 20.79583, 24.47831]
two = [2.332242, 2.720949, 3.252864, 3.795008, 4.572422]
three = [10.16776, 12.08061, 15.11866,17.00082, 19.90589]
x = np.arange(len(labels)) # 标签位置
width = 0.20 # 柱状图宽度
fig, ax = plt.subplots()
rects1 = ax.bar(x - width * 0.60, one, width, label='农地流转比例', hatch='...', color='w', edgecolor='k')
rects2 = ax.bar(x + width * 0.60, two, width, label='正式流转比例(非熟人)', hatch='***', color='w', edgecolor='k')
rects3 = ax.bar(x + width * 1.80, three, width, label='非正式流转比例(熟人)', hatch='//', color='w', edgecolor='k')
ax.set_ylabel('百分比 %')
ax.set_xticks(x)
plt.ylim(0, 45)
ax.set_xticklabels(labels, rotation=0)
# 在每个柱状图的顶部添加数字标注
def autolabel(rects):
for rect in rects:
height = rect.get_height()
ax.annotate('{:.1f}'.format(height), # 格式化字符串,保留一位小数
xy=(rect.get_x() + rect.get_width() / 2, height),
xytext=(0, 3), # 3 points vertical offset
textcoords="offset points",
ha='center', va='bottom')
autolabel(rects1)
autolabel(rects2)
autolabel(rects3)
fig.tight_layout()
# 将图例放在底部
# 将图例放在底部
ax.legend(loc='lower center', bbox_to_anchor=(0.5, -0.2), ncol=3)
plt.savefig("land_dx.png", dpi=750, bbox_inches='tight')
plt.show()
## 图I4 土地流转中的正式与非正式流转(合同形式) a面积占比
import matplotlib.pyplot as plt
import numpy as np
# 设置中文字体
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
labels = ['2014', '2015', '2016', '2017', '2018']
one = [23.60565, 26.07236, 29.97162, 32.68684, 39.90594]
two = [6.964076 , 7.508421, 8.429195, 9.487744, 13.55533]
three = [16.62981, 18.55217, 21.53066, 23.18733, 26.33883]
x = np.arange(len(labels)) # 标签位置
width = 0.20 # 柱状图宽度
fig, ax = plt.subplots()
rects1 = ax.bar(x - width * 0.60, one, width, label='农地流转比例', hatch='...', color='w', edgecolor='k')
rects2 = ax.bar(x + width * 0.60, two, width, label='正式流转比例(书面合同)', hatch='***', color='w', edgecolor='k')
rects3 = ax.bar(x + width * 1.80, three, width, label='非正式流转比例(口头合约)', hatch='//', color='w', edgecolor='k')
ax.set_ylabel('百分比 %')
ax.set_xticks(x)
plt.ylim(0, 45)
ax.set_xticklabels(labels, rotation=0)
# 在每个柱状图的顶部添加数字标注
def autolabel(rects):
for rect in rects:
height = rect.get_height()
ax.annotate('{:.1f}'.format(height), # 格式化字符串,保留一位小数
xy=(rect.get_x() + rect.get_width() / 2, height),
xytext=(0, 3), # 3 points vertical offset
textcoords="offset points",
ha='center', va='bottom')
autolabel(rects1)
autolabel(rects2)
autolabel(rects3)
fig.tight_layout()
# 将图例放在底部
# 将图例放在底部
ax.legend(loc='lower center', bbox_to_anchor=(0.5, -0.2), ncol=3)
plt.savefig("land_hetongarea.png", dpi=750, bbox_inches='tight')
plt.show()
## 图I4 土地流转中的正式与非正式流转(合同形式) b农户数占比
import matplotlib.pyplot as plt
import numpy as np
# 设置中文字体
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
labels = ['2014', '2015', '2016', '2017', '2018']
one = [21.9193, 26.3904, 32.06107, 36.09597, 41.11232]
two = [4.525627, 5.507088, 7.142857, 8.069793, 9.541985]
three = [17.61178, 21.21047, 25.68157, 28.95311, 32.93348]
x = np.arange(len(labels)) # 标签位置
width = 0.20 # 柱状图宽度
fig, ax = plt.subplots()
rects1 = ax.bar(x - width * 0.60, one, width, label='农户流转比例', hatch='...', color='w', edgecolor='k')
rects2 = ax.bar(x + width * 0.60, two, width, label='农户正式流转比例(书面合同)', hatch='***', color='w', edgecolor='k')
rects3 = ax.bar(x + width * 1.80, three, width, label='农户非正式流转比例(口头合约)', hatch='//', color='w', edgecolor='k')
ax.set_ylabel('百分比 %')
ax.set_xticks(x)
plt.ylim(0, 45)
ax.set_xticklabels(labels, rotation=0)
# 在每个柱状图的顶部添加数字标注
def autolabel(rects):
for rect in rects:
height = rect.get_height()
ax.annotate('{:.1f}'.format(height), # 格式化字符串,保留一位小数
xy=(rect.get_x() + rect.get_width() / 2, height),
xytext=(0, 3), # 3 points vertical offset
textcoords="offset points",
ha='center', va='bottom')
autolabel(rects1)
autolabel(rects2)
autolabel(rects3)
fig.tight_layout()
# 将图例放在底部
# 将图例放在底部
ax.legend(loc='lower center', bbox_to_anchor=(0.5, -0.2), ncol=3)
plt.savefig("land_nhhtlz.png", dpi=750, bbox_inches='tight')
plt.show()
## 图I4 土地流转中的正式与非正式流转(合同形式) c地块数占比
import matplotlib.pyplot as plt
import numpy as np
# 设置中文字体
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
labels = ['2014', '2015', '2016', '2017', '2018']
one = [12.5, 14.80155, 18.37152, 20.79583, 24.47831]
two = [2.096972, 2.526596, 3.171031, 3.692717, 4.470131]
three = [10.34165, 12.21358, 15.13912, 17.04173 , 19.94681]
x = np.arange(len(labels)) # 标签位置
width = 0.20 # 柱状图宽度
fig, ax = plt.subplots()
rects1 = ax.bar(x - width * 0.60, one, width, label='农地流转比例', hatch='...', color='w', edgecolor='k')
rects2 = ax.bar(x + width * 0.60, two, width, label='正式流转比例(书面合同)', hatch='***', color='w', edgecolor='k')
rects3 = ax.bar(x + width * 1.80, three, width, label='非正式流转比例(口头合约)', hatch='//', color='w', edgecolor='k')
ax.set_ylabel('百分比 %')
ax.set_xticks(x)
plt.ylim(0, 45)
ax.set_xticklabels(labels, rotation=0)
# 在每个柱状图的顶部添加数字标注
def autolabel(rects):
for rect in rects:
height = rect.get_height()
ax.annotate('{:.1f}'.format(height), # 格式化字符串,保留一位小数
xy=(rect.get_x() + rect.get_width() / 2, height),
xytext=(0, 3), # 3 points vertical offset
textcoords="offset points",
ha='center', va='bottom')
autolabel(rects1)
autolabel(rects2)
autolabel(rects3)
fig.tight_layout()
# 将图例放在底部
# 将图例放在底部
ax.legend(loc='lower center', bbox_to_anchor=(0.5, -0.2), ncol=3)
plt.savefig("land_ht.png", dpi=750, bbox_inches='tight')
plt.show()
## 图II1 新一轮土地确权颁证政策实施进展
import matplotlib.pyplot as plt
import numpy as np
# 设置中文字体
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
labels = ['2014', '2015', '2016', '2017', '2018']
one = [19, 54, 81, 93, 95]
two = [5.391912, 14.52821, 35.5966, 58.91163, 69.94508]
three = [0.3994009, 3.994009, 15.27708, 33.5996, 50.27459]
four = [0, 2, 10, 29, 52]
x = np.arange(len(labels)) # 标签位置
width = 0.19 # 柱状图宽度
fig, ax = plt.subplots()
rects1 = ax.bar(x - width * 1.50, one, width, label='村庄开始确权', hatch='...', color='w', edgecolor='k')
rects2 = ax.bar(x - width * 0.30, two, width, label='农户开始确权', hatch='***', color='w', edgecolor='k')
rects3 = ax.bar(x + width * 0.90, three, width, label='农户确权颁证', hatch='//', color='w', edgecolor='k')
rects4 = ax.bar(x + width * 2.10, four, width, label='村庄完成确权', hatch='ooo', color='w', edgecolor='k')
ax.set_ylabel('百分比 %')
ax.set_xticks(x)
plt.ylim(0, 100)
ax.set_xticklabels(labels, rotation=0)
# 在每个柱状图的顶部添加数字标注
def autolabel(rects):
for rect in rects:
height = rect.get_height()
ax.annotate('{:.1f}'.format(height), # 格式化字符串,保留一位小数
xy=(rect.get_x() + rect.get_width() / 2, height),
xytext=(0, 3), # 3 points vertical offset
textcoords="offset points",
ha='center', va='bottom')
autolabel(rects1)
autolabel(rects2)
autolabel(rects3)
autolabel(rects4)
fig.tight_layout()
# 将图例放在底部
# 将图例放在底部
ax.legend(loc='lower center', bbox_to_anchor=(0.5, -0.2), ncol=4)
plt.savefig("leiji.png", dpi=750, bbox_inches='tight')
plt.show()