I am trying to put two types of plot in one figure like below:
fig, axes = plt.subplots(25, 1, figsize=(8, 32), sharex=True, sharey=False)
names = my_df['person'].values.tolist()
for i in range(len(names)):
:
:
ax = my_df.plot(x='timestamp', y='col_A', kind='bar', color = 'b', \
alpha = 0.7, ax=axes[i])
my_df.plot(x='timestamp', y='col_A', kind='bar', color = 'b', alpha = 0.5, ax=axes[i])
my_df.plot(x='timestamp', y='col_B', color = 'r', alpha = 0.5, ax=axes[i])
The figure works fine if I just plot one of them. I.e.
my_df.plot(x='timestamp', y='col_A', kind='bar', color = 'b', alpha = 0.5, ax=axes[i])
works fine by itself.
my_df.plot(x='timestamp', y='col_B', color = 'r', alpha = 0.5, ax=axes[i])
also works fine by itself.
However, these two plots could not show together on the same figure. I am guessing my axes wasn't defined properly? Is there a way to fix it? Thanks!