| import matplotlib.pyplot as plt | |
| import seaborn as sns | |
| def plot_engagement_heatmap(engagement_by_hour): | |
| """Plot engagement heatmap by time of day.""" | |
| plt.figure(figsize=(10, 6)) | |
| sns.heatmap(engagement_by_hour.pivot_table(index='hour', values='engagement_rate'), annot=True, cmap='YlGnBu') | |
| plt.title('Engagement Heatmap by Time of Day') | |
| plt.xlabel('Engagement Rate') | |
| plt.ylabel('Hour of Day') | |
| plt.show() | |
| def plot_engagement_over_time(engagement_summary): | |
| """Plot engagement rate over time.""" | |
| plt.figure(figsize=(10, 6)) | |
| plt.plot(engagement_summary['posting_time'], engagement_summary['engagement_rate']) | |
| plt.title('Engagement Rate Over Time') | |
| plt.xlabel('Time') | |
| plt.ylabel('Engagement Rate') | |
| plt.show() |