I want to a plot a linear fit as shown (in cyan) between the x axis values as choosen which should be user defined . I tried to filter out the x axis array greater than lower limit and less than upper limit and plot but due to rest of data in array as NaN the linear fit doesnt work.