我正在创建以下情节,它似乎在右侧留下了一些额外的空白,我不确定为什么。
生成上述代码的代码如下:
import matplotlib.pyplot as plt
d1 = (0,1,3,6,4,2,2,59,4,3,4,4,33,3,2,5,61)
d2 = (6,7,9,4,4,4,3,19,4,1,11,28,13,8,15,28,28)
d3 = (6,7,9,4,4,4,3,19,4,1,14,28,13,8,15,28,32)
N = len(d1)
ind = np.arange(N)
width = 0.2
font = {'family' : 'sans-serif', 'weight' : 'normal', 'size' : 10}
matplotlib.rc('font', **font)
fig,ax = plt.subplots()
rects1 = ax.bar(ind, MA_DPU, width, color='r', alpha=0.7)
rects2 = ax.bar(ind+width, res1, width, color='b', alpha=0.7)
rects3 = ax.bar(ind+2*width, res2, width, color='g', alpha=0.7)
ax.set_xticks(ind+width*1.5)
plt.show()