I am trying to line up the attached plots so I can properly fit Gaussians to them but am not sure how to do so. I want them to have the same baseline. This is how I read in the data:
fig = plt.figure(figsize=(16, 8), dpi=360)
plt.xlabel('wavenumbers (cm^-1)', fontsize=18)
plt.ylabel('absorbance', fontsize=16)
plt.xlim(4000,650)
for i in range((len(data.columns))):
if i%2 == 0:
xdata = data.iloc[100:,i]
ydata = data.iloc[100:,i+1]
plt.plot(xdata,ydata, label = str(data.columns[i+1]))
Then I use a Gaussian function to fit to my data but it doesn't work.
#locations of peaks to bias model
peak_locations = [985] #enter values here for peak locations
numb_of_peaks = len(peak_locations)
def gaussian_basis(x, xk , sigma = 1):
# x is a vector
# k is the "index" of the basis
# sigma is the standard deviation
return np.exp(-((x - xk)**2/(2*sigma**2)))
The image of my data is attached. How can I have the plots have the same baseline to show the peaks increasing?