import matplotlib.pyplot as plt import matplotlib.font_manager myfont=matplotlib.font_manager.FontProperties(fname='C://Windows//Fonts//Msyh.ttc',size=20) a = ["猩球崛起3:终极之战","敦刻尔克","蜘蛛侠:英雄归来","战狼2"] b_16 = [15746,312,4497,319] b_15 = [12357,156,2045,168] b_14 = [2358,399,2358,362] barwidth=0.2 x_14=list(range(len(a))) x_15=list(i+barwidth for i in x_14) x_16=list(i+barwidth for i in x_15) fig=plt.figure(figsize=(20,8),dpi=80) plt.bar(range(len(a)),b_14,width=barwidth,label="14日") plt.bar(x_15,b_15,width=barwidth,label="15日") plt.bar(x_16,b_16,width=barwidth,label="16日") plt.legend(loc='upper right',prop=myfont) plt.xticks(x_15,a,fontproperties=myfont) plt.show()
matplotlib常用的统计图画法
最新推荐文章于 2024-06-14 09:50:01 发布