title: How to create plot from train and test target
body: <p>I'm trying to create a single figure that plot my <code>y_train</code> and <code>y_pred</code> with date as x-axis. I have never created the one like this before so i'm kind of confused. How could i create it like the example of figure below? So far i'm only able to create similar figure but the line does not connected, how to make it connected?</p>
  
  <p><a href="https://i.stack.imgur.com/ChhCk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ChhCk.png" alt="this image"></a></p>
  
  <pre><code>X = np.array(covid.drop(['acc_deceased'],1))
  y = np.array(covid['acc_deceased'])
  
  X_train,X_test,y_train,y_test = train_test_split(X,y,test_size=0.2,
                                                   shuffle = False)
  
  lr = LinearRegression()
  
  lr.fit(X_train,y_train)
  
  y_pred = lr.predict(X_test)
  
  pred = pd.DataFrame(y_pred, columns = ['y_pred'])
  train = pd.DataFrame(y_train,columns = ['y_train'])
  final = pd.concat([train,pred],ignore_index=True,sort=False)
  final = final.set_index(covid.index)
  plt.figure(figsize=(10,5))
  sns.lineplot(x=final.index, y=final['y_train'])
  sns.lineplot(x=final.index, y=final['y_pred'])
  plt.legend(['y_train','y_pred','y_test'],
              loc='upper left')
  plt.ylabel('y')
  </code></pre>
  
  <p>This is my figure</p>
  
  <p><a href="https://i.stack.imgur.com/73W9b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/73W9b.png" alt="my figure"></a></p>