# Plot overlapping time series [closed]

I'm trying to plot my test set and test set predictions to check the differences and see how my autoencoder reconstructed the data, but since I have a test set 30x10 I have a huge visualization problem: How can I solve it? This is the code, I'm just showing the first row (X-test), but I have 29 more and I don't how to show all of them properly.

fig = plt.figure()
plt.plot(X_test.T, label='y_true')
plt.plot(x_test_pred.T, label='yhat_conv')
_ = plt.legend()
plt.show()
plt.close()

• Could you give us the shapes of X_test so that we can maybe synthetically reproduce the plot?
– PSub
Mar 19 at 3:16
• What about plotting the differences - i.e. y_true - yhat_conv (or the other way round) ... basically they look like they are going to have a small'ish variance ..
– Mr R
Mar 19 at 6:37
• And offset a few of them (i.e. add 3 to some of the differences and 6 to some more - if you can control the colours pick them too to make pairs line up easily but be visually different [so you only end up with 2/3 per line row of differences instead of 10]...
– Mr R
Mar 19 at 6:40
• Or eliminate all the ones where the difference is really low and only look at the "worst" ??
– Mr R
Mar 19 at 6:40
• @PSub The shape of X_test is (3000, 10, 30) Mar 19 at 6:47

It's not going to be pretty, but you just for-loop your code:

ax, fig = plt.subplots()
for i in range(30):
ax.plot(X_test[i].T, label='y_true_' + i)
ax.plot(x_test_pred[i].T, label='yhat_conv' + i)
plt.show()


Because you have so many lines, it would be best to remove the legend from the plot as it will be too much information to interpret. You could use additional subplots e.g. ax,fig = plt.subplots(5,6) and plot one row on each subplot e.g. ax.plot(first_plot) etc.

It might be more suitable to generate some summary statistics or differences of the lines (as suggested in the comments). One way would also to plot the error bars/distributions of the lines as shaded regions and just the line of the average for particular groups, similar to the plot below: 