This?
import matplotlib.pyplot as plt import numpy as np def list_diff(l1, l2): new_list = [] for n, item in enumerate(l1): new_list.append(item - l2[n]) return new_list X_ev = np.array([0, 1, 2, 3]) Y1_ev = np.array([10, 15, 20, 25]) Y2_ev = np.array([2, 10, 10, 15]) print(f"distance between points: {list_diff(Y1_ev, Y2_ev)}") plt.plot(X_ev,Y1_ev, 'g', label='Curve 1') plt.plot(X_ev,Y2_ev, 'r', label='Curve 2') SEGMENT = min(Y1_ev-Y2_ev) print('SEGMENT') print(SEGMENT) plt.legend(numpoints=3) plt.show()