# 3.2 小费与总账单的散点图(看相关性)
sns.scatterplot(data=df, x='total_bill', y='tip', hue='time', ax=axes[0,1])
axes[0,1].set_title('Tip vs Total Bill (Colored by Meal Time)')
# 3.4 吸烟与否的账单均值柱状图
bill_by_smoker = df.groupby('smoker')['total_bill'].mean().reset_index()
sns.barplot(data=bill_by_smoker, x='smoker', y='total_bill', ax=axes[1,1])
axes[1,1].set_title('Average Total Bill by Smoking Status') for index, row in bill_by_smoker.iterrows():
axes[1,1].text(index, row['total_bill']+0.5, f"{row['total_bill']:.1f}", ha='center')