#!/usr/bin/python from pylab import * y, x = loadtxt("FeAl28-sample1-2.XLS",usecols=(2,3),unpack=True)[:,5:-2] x = -x plot(x,y) data = array(ginput(2)) a,b = sort(data[:,0]) c = b-a xx = array([a-c/5,b+c/5]) m = (x>=a) & (x<=b) plot(x[m], y[m], lw=5) a,b = polyfit(x[m], y[m], 1) plot(xx,a*(xx+b/a)) figure() plot(x+b/a-y/a, y) show()