SoraHeart
SoraHeart

Reputation: 430

Python Add_Lowest to sns.lineplt

How can i make the line disappear?

rmodel = sm.GLM.from_formula("rBPXSY1 ~ rRIDAGEYR", data=da)
res = rmodel.fit()
res.summary()

pp = sns.lineplot(da.rRIDAGEYR,da.rBPXSY1,alpha=0.4, marker='o', ls='')
add_lowess(pp) 

Intended result

enter image description here

**My result **

enter image description here

Upvotes: 0

Views: 113

Answers (1)

Kevin S
Kevin S

Reputation: 2803

When using the latest versions of each package, and running

import statsmodels.api as sm
import numpy as np
import seaborn as sns
from statsmodels.graphics.regressionplots import add_lowess

g = np.random.default_rng(0)
x = g.random(size=1000)
y = 5*np.sin(2*np.pi*x) + g.standard_normal(1000)
pp = sns.lineplot(x=x,y=y,alpha=0.4, marker='o', ls='')
pp = add_lowess(pp)

you get an image like the one you desire:

Scatter with LOWESS

Upvotes: 1

Related Questions