'How to adjust the spacing between two series of the same plot

To build this curve I do the following :

MyPlot.plot(MyMatrix[MyMatrix["Date"]<=today]['Date'],MyMatrix[MyMatrix["Date"]<=today]['Y'], color="red")
MyPlot.plot(MyMatrix[MyMatrix["Date"]>=today]['Date'],MyMatrix[MyMatrix["Date"]>=today]['Y'], color="blue")

Does a way exist to not have a blank space between it ?

What I do Have :

enter image description here

What I Would Like to have :

enter image description here



Solution 1:[1]

This is my idea: adding to the blue line the last element of the red line:

#take the maximum x value for MyMatrix["Date"]<=todaythe red line
last_x =max(MyMatrix[MyMatrix["Date"]<=today]['Date'])

#plot starting from the last "red" sample
MyPlot.plot(MyMatrix[MyMatrix["Date"]>=last_x]['Date'], 
             MyMatrix[MyMatrix["Date"]>=last_x]['Y'], color="blue")

Edited

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1