Scipy curve_fit: how to plot the fitted curve beyond the data points?
I have a number of data points and I used Scipy curve_fit to fit a curve to this data set. I now would like to plot the fit beyond the range of data points and I cannot find out how to do it. Here is a simple example based on an exponential fitting: import numpy as np from scipy.optimize import curve_fit import matplotlib.pyplot as plt def exponential_fit(x, a, b, c): return a*np.exp(-b*x) + c x = np.array([0, 1, 2, 3, 4, 5]) y = np.array([30, 50, 80, 160, 300, 580]) fitting_parameters, covariance = curve_fit(exponential_fit, x, y) a, b, c = fitting_parameters plt.plot(x, y, 'o', label='data')