I installed matplotlib 2.1 from version 2.0.2 and my simple 2D x-y plots are now showing the y-axis with a log scale, when before the scale was linear. I am not sure how this is happening.
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.gridspec as gridspec
from numpy import sqrt, pi, exp, linspace, loadtxt
from lmfit import Model
path=r'C:\users\test.mca'
f=open(path,'r')
lines=f.readlines()[14:2060]
x=[]
for i in range(0,2046):
x.append(i)
plt.figure(figsize=(10,6))
plt.xlim(0,600)
plt.ylim(0,1000)
plt.grid(True)
plt.xlabel('Channels')
plt.ylabel('Counts')
def gaussian(x, amp, cen, wid):
"1-d gaussian: gaussian(x, amp, cen, wid)"
return (amp/(sqrt(2*pi)*wid)) * exp(-(x-cen)**2 /(2*wid**2))
gmod = Model(gaussian)
pars = gmod.make_params(amp=15000, wid=14, cen=380)
result = gmod.fit(lines, pars, x=x)
print(result.fit_report())
fwhm=result.params['wid'].value*2.35
ER=100*fwhm/result.params['cen'].value
center=result.params['cen']
plt.title('Gaussian fit\n Center=%.1f FWHM=%.1f ER=%.1f%%' % (center, fwhm, ER))
plt.plot(x, lines,'bo', markersize=4)
plt.plot(x, result.best_fit, 'r-')
plt.show()
Version 2.1:

Version 2.0.2:

The top figure is plotted using 2.1 and the bottom figure is using 2.0.2. Having some trouble understanding why this is.