import matplotlib.pyplot as plt import seaborn as sns sns.set_style("darkgrid") plt.rcParams["font.sans-serif"]="SimHei" plt.rcParams["axes.unicode_minus"]=False fig,ax = plt.subplots(figsize=(8,4),dpi=300) ax1 = book_order_day_1.plot(x="date",y="order_number",xticks=range(0,95,5),ax=ax,label="訂單量",xlabel="",ylabel="訂單量",rot=180) ax2 = book_order_day_2.plot(x="date",y="user_n",secondary_y=True,ax=ax,label="購買用戶數",mark_right=False,xlabel="",rot=-90) plt.ylabel("購買用戶數")
參考博客:https://www.codenong.com/53577630/