Thursday, 22 June 2023

Plot regression confidence interval using seaborn.objects interface (v0.12)

I'm trying to use the objects API to plot a regression line with confidence limits (like sns.regplot / sns.lmplot).

Based on the so.Band fmri example, I thought it would be something like this:

import seaborn as sns
import seaborn.objects as so

(so.Plot(sns.load_dataset("tips"), x="total_bill", y="tip")
   .add(so.Dots())
   .add(so.Line(), so.PolyFit()) # regression line
   .add(so.Band(), so.Est())     # confidence band
)

But I'm getting an unexpected result (left). I'm expecting something like the regplot band (right).

current and expected output



from Plot regression confidence interval using seaborn.objects interface (v0.12)

No comments:

Post a Comment