plt.plot(secret_data_X1, secret_data_Y1, 'r')
plt.plot(secret_data_X2, secret_data_Y2, 'b')
X, Y = [], []
for lines in plt.gca().get_lines():
    for x, y in lines.get_xydata():
        X.append(x)
Y.append(y)
idx = np.argsort(X)
X = np.array(X)[idx]
Y = np.array(Y)[idx]
plt.subplot(2, 1, 2)
plt.plot(X, Y, 'g')
plt.show()
Merge two existing plots into one plot