I want to plot 2 subplots with their x-axis being date (which is the same for both x axis). However, when i do the plot, only one of the subplots got the xticks format i wanted. How do i make the xtick format work for both subplots?
trend1 = pd.read_sql(query1, conn)
trend1['date'] = pd.to_datetime(trend1['date']).dt.date
trend2 = pd.read_sql(query2, conn)
trend2['date'] = pd.to_datetime(trend2['date']).dt.date
fig, ax = plt.subplots(ncols=2, figsize=(15,4))
data1 = trend1.set_index('date').sort_index().reset_index()
data2 = trend2.set_index('date').sort_index().reset_index()
sns.lineplot(data = data1,
x='date', y='count_1', hue='country', ax=ax[0])
sns.lineplot(data = data2,
x='date', y='count_2', hue='country', ax=ax[1])
plt.xticks(
rotation=45,
horizontalalignment='right',
fontweight='light',
fontsize='small'
)