python plot intersection of line and data
问题 I have a data file that looks something like this: 0 0 0.1 0.1 0.2 0.2 0.3 0.3 0.4 0.31 0.5 0.32 0.6 0.35 And I would like to find the the value that intersects with a slope. My code looks like this so far: from numpy import * from pylab import * data = loadtxt('test.dat') strain = data[:,0] stress = data[:,1] E = 1 y = [0, 0.5] x = 0.2, ((y[1] - y[0])/E+0.2) figure(num=None, figsize=(10, 6), dpi=100, facecolor='w', edgecolor='k') plot(strain, stress) plot(x, y) show() 回答1: You can use the