I'm trying to plot two different dataframes on the same plot. But it only shows the second one. I have two dataframes: reconstructed and expected with the same shape. I need to plot them based on indexes (idx). So first I need to partition them based on each index; that is done by ts_rec = reconstructed.loc[idx] and ts_exp = expected.loc[idx]. Then I should plot these two new dataframes. Each of them has 28 columns, so I have 28 subplots with layout=(7, 4). The problem is that it only shows the second (red) timeseries, but I need to have both of them to be able to compare their values. How can I fix this?
ts_rec = reconstructed.loc[idx]
ts_exp = expected.loc[idx]
x = np.arange(ts_rec.shape[0])
ts_rec.plot(
x=x, subplots=True, layout=(7, 4), lw=2, legend=False,
figsize=(12, 10), sharey=True, color='green')
ts_exp.plot(
x=x, subplots=True, layout=(7, 4), lw=2, legend=False,
figsize=(12, 10), sharey=True, color='red')
pyplot.title("Timeseries id = %d" % idx)
pyplot.xlim(xmin=0)
pyplot.show()
pyplot.savefig(config['dir'] + 'ts_' + str(idx) + '.pdf')
pyplot.clf()