1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| from matplotlib import pyplot as plt import matplotlib
x = range(2, 26, 2)
y = [15, 13, 14.5, 17, 20, 25, 26, 26, 24, 22, 18, 15] z = [1, 3, 145, 17, 2, 5, 26, 2, 14, 2, 16, 15]
u = ['葛震鹏', '张永记', '谢长友', '北邮', '睡觉']
v = [10, 50, 30, 70, 58]
v_1 = [1, 5, 6, 8, 3]
font = { 'family': 'MicroSoft YaHei', 'weight': 'bold' }
matplotlib.rc("font", **font)
plt.figure(figsize=(16, 8), dpi=80)
x_1 = list(range(len(u)))
x_2 = [i + 0.2 for i in x_1]
plt.barh(u, v, height=0.2) plt.barh(x_2, v_1, height=0.2)
plt.show()
|