title: How to use curvefit in python
body: <p>I am studying nonlinear curvefit with python.<br>
  I made example like below. <br>
  But the optimized plot is not drawn well<br></p>
  
  <pre><code>plt.plot(basketCont, fittedData)
  </code></pre>
  
  <p>I guess the optimized parametes are not good also.<br>
  Could you give some recommends? Thank you.</p>
  
  <pre><code>import matplotlib
  matplotlib.use('Qt4Agg')
  import matplotlib.pyplot as plt
  from matplotlib.pyplot import cm
  import numpy as np
  from scipy.optimize import curve_fit 
  
  def func(x, a, b, c):
      return a - b* np.exp(c * x) 
  
  baskets = np.array([475, 108, 2, 38, 320])
  scaling_factor = np.array([95.5, 57.7, 1.4, 21.9, 88.8])
  
  popt,pcov = curve_fit(func, baskets, scaling_factor)
  
  print (popt)
  print (pcov)
  
  basketCont=np.linspace(min(baskets),max(baskets),50)
  fittedData=[func(x, *popt) for x in basketCont]
  
  fig1 = plt.figure(1)
  
  plt.scatter(baskets, scaling_factor, s=5)
  plt.plot(basketCont, fittedData)
  
  plt.grid()
  
  plt.show()
  </code></pre>