##;练习1,利用图表分析规律。
练习2 直观体现出不同电影近三天的票房的对比情况
movies_name = [“变身特工”,“美丽人生”,“鲨海逃生”,“熊出没·狂野大陆”]
day_12 = [2358,399,2358,362]
day_13 = [12357,156,2045,168]
day_14 = [15746,312,4497,319]
width=0.3
po_1=[i-width/34 for i in list(range(len(movies_name)))]
po_2=[i-width/3 for i in list(range(len(movies_name)))]
po_3=[i+width/32 for i in list(range(len(movies_name)))]
#plt.bar(list(range(len(day_13))),movies_name,width)
#plt.bar(movies_name,day_13,width)
plt.bar(po_1,day_12,width,label=“day12”)
plt.bar(po_2,day_13,width,label=“day13”)
plt.bar(po_3,day_14,width,label=“day14”)
plt.xticks(list(range(len(movies_name))),movies_name)
def auto_label(x_po,y_po):
for x_i,y_i in zip(x_po,y_po):
plt.annotate(f"{y_i}",xy=(x_i,y_i),xytext=(x_i,y_i))
auto_label(po_1,day_12)
auto_label(po_2,day_13)
auto_label(po_2,day_14)
plt.legend()
plt.show()