Reputation: 819
Here's the least-square quadratic fitting result of my data: y = 0.06(+/- 0.16)x**2-0.65(+/-0.04)x+1.2(+/-0.001). I wonder is there a direct way to plot the fit as well as the error band? I found a similar example which used plt.fill_between
method. However, in that example the boundaries are known, while in my case I'm not quite sure about the exact parameters which correspond to the boundaries. I don't know if I could use plt.fill_between
or a different approach. Thanks!
Upvotes: 0
Views: 900
Reputation: 260410
You can use seaborn.regplot
to calculate the fit and plot it directly (order=2
is second order fit):
Here is a dummy example:
import seaborn as sns
import numpy as np
xs = np.linspace(0, 10, 50)
ys = xs**2+xs+1+np.random.normal(scale=20, size=50)
sns.regplot(x=xs, y=ys, order=2)
Upvotes: 1