You can pad the arrays to same size with filling small array to zero or none : use this snippet to make it :
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import datetime
a = np.array(['2017-09-15 07:11:00', '2017-09-15 12:11:00', '2017-12-22 06:35:00'], dtype='datetime64[ns]')
b = np.array(['2017-09-10 02:25:00', '2017-12-11 03:11:00'], dtype='datetime64[ns]')
s1=[11,-3,4]
s2=[2,4]
m = max(len(s1),len(s2))
a1=[None] * m
a2=[None] * m
ax1=[None] * m
ax2=[None] * m
for i in range(len(s1)):
a1[i] = s1[i]
ax1[i]=a[i]
for i in range(len(s2)):
a2[i] = s2[i]
ax2[i]=b[i]
graph= pd.DataFrame({
'A Values': np.array(a1),
'B Values': np.array(a2)
}, index= [ax1,ax2]).plot.line()
plt.xticks(rotation=0)
plt.tick_params(axis='both', which='major', labelsize=5)
#labelsize=5 instead of labelsize=10
plt.show()
Output:
I hope you find it useful
CLICK HERE to find out more related problems solutions.