Aligning multiple line plots according to x-axis in matplotlib

  matplotlib, python

I have a matplotlib image output that look like this:

https://i.stack.imgur.com/1ZBz4.jpg

I want to align the plot according to the red line in the image, can anyone kindly suggest a way to do it
? Preferably some callable functions or online tutorial.
The code for the output as folllow:

total_files = sorted(os.listdir())
print(total_files)

temp = pd.DataFrame()
plt.figure(figsize=(100,50))
for content in total_files:
    file_data = np.loadtxt(content)
    df = pd.DataFrame(file_data,columns=["time","data1","data2"])
    df.drop('data1',axis=1, inplace=True)
    df['data2']=df['data2']+(total_files.index(content)*1e6)
    temp = temp.append(df)
    plt.plot(df,color='black')

display(temp)

plt.show()

and the sample data (.log):

# 0000001 20/04/2016 11:49:43.0652618 +22.48901749d +119.67559052    3.4435E+06
   0.000  -3.6751E+04 -3.6430E+04
   0.002  -5.4546E+04 -5.4225E+04
   0.004  -4.4184E+04 -4.3863E+04
   0.006  -4.9037E+04 -4.8716E+04
   0.008   1.3833E+04  1.4154E+04
   0.010   7.2276E+04  7.2597E+04 
   ...
   ...
   7.990   5.5767E+04  5.6088E+04
   7.992   5.5981E+04  5.6302E+04
   7.994   7.0995E+04  7.1316E+04
   7.996   6.3599E+04  6.3920E+04
   7.998   7.9496E+04  7.9817E+04
   8.000   1.2661E+05  1.2693E+05

Source: Python Questions

LEAVE A COMMENT