完善版矩阵堆积

#coding:gbk
import matplotlib.pyplot as plt
import numpy as nmp

y1 = [52, 49, 48, 47, 44, 43, 41, 41, 40, 38, 36, 31, 29]
y2 = [38, 40, 45, 42, 48, 51, 53, 54, 57, 59, 57, 64, 62]
y3 = [10, 11, 7, 11, 8, 6, 6, 5, 3, 3, 7, 5, 9]
x = ['种\n族\n关\n系', '教\n育', '恐\n怖\n活\n动', '能\n源\n政\n策', '外\n交\n事\n物', '环\n境', '伊\n拉\n克\n局势',
 '税\n收', '医\n疗\n保\n健\n政\n策', '经\n济', '阿\n富\n汗\n局\n势', '联\n邦\n预\n算\n赤\n字', '外\n来\n移\n民']
 
plt.rc('font', family='STSong', size = 10)
plt.bar(x, y1, 0.5, color = '#809EAD')
plt.bar(x, y2, 0.5, bottom = y1, color = '#B1C0C9')

for i in range(len(y1)):
	y1[i] = y1[i] + y2[i]
plt.bar(x, y3, 0.5, bottom = y1, color = '#D7D6CB')

plt.show()

猜你喜欢

转载自blog.csdn.net/AK47red/article/details/89156808
今日推荐