我试图为每个N值绘制3个条形图。数据是:
N=['A','B','C','D','E','F']
SF = (0.87,9.4,49,110,820,1752)
IRT = (0.34,25,210,487,2861,5541)
IRTO = (0.5,33,271,568,3031,6314)
这些w(宽度),y_pos和figsize的数量基本上只是试验和错误,直到它看起来足够我的眼睛......
w = 1
y_pos = 4*np.arange(len(N))
fig, ax = plt.subplots(figsize=(10,5))
rects1 = ax.bar(y_pos - w, SF, align='center', alpha=0.7, width=w, color="lightgrey", log=True)
rects2 = ax.bar(y_pos , IRT, align='center', alpha=1.0, width=w, color="grey", log=True)
rects3 = ax.bar(y_pos + w, IRTO, align='center', alpha=1.0, width=w, color="black", log=True)
plt.xticks(y_pos,N,fontsize=13)
legend = ax.legend((rects1[0], rects2[0], rects3[0]), ('SF', 'IRT', 'IRTO'), loc='upper left')
plt.show()
所有这些都会产生以下情节:
这很不错,不幸的是我喜欢让一切尽可能完美,所以我想基本上做4个: