mwaskom / seaborn

Statistical data visualization in Python
https://seaborn.pydata.org
BSD 3-Clause "New" or "Revised" License
12.59k stars 1.93k forks source link

Linear regression constrained to pass through origin #3743

Closed danieleades closed 3 months ago

danieleades commented 3 months ago

I'd like to generate a linear line of best fit on a scatter plot with a confidence interval. I happen to know that the line must pass through the origin so the only free parameter is the slope of the line.

Does seaborn provide a way to constrain the y intercept of the regression line and confidence interval to be 0?

mwaskom commented 3 months ago

No, sorry, if you need a more complex model then I recommend fitting it yourself and plotting the predictions.

danieleades commented 3 months ago

No, sorry, if you need a more complex model then I recommend fitting it yourself and plotting the predictions.

Is there a way to do that and recycle most of the seaborn view logic? I don't mind doing my own fitting but would rather avoid reinventing the wheel trying to create a nice pretty seaborn.regplot clone