3

seaborn.regplot() fits a linear model to 2D data. It would be very convenient to get the parameters for the linear model returned from the function. However, it only returns an axis object. Is there a way to extract the data from the axis object? Is there a seaborn function that I could call in order to produce these parameters for me? Or would I need to go all the way to call my own fitting function?

x = range(10)
y = sin(x)
df = pd.DataFrame({'x': x, 'y': y})
ax = sns.regplot('x', 'y', df)

This would be very useful for figures that go into publications.

Soerendip
  • 7,684
  • 15
  • 61
  • 128
  • 1
    Possible duplicate of [How to get the numerical fitting results when plotting a regression in seaborn?](https://stackoverflow.com/questions/22852244/how-to-get-the-numerical-fitting-results-when-plotting-a-regression-in-seaborn) – Bonlenfum Sep 24 '18 at 19:08
  • 2
    Sadly it is not possible to access the `regplot` fitting parameters (by seaborn package author): https://stackoverflow.com/a/22852265 – Bonlenfum Sep 24 '18 at 19:09

0 Answers0