帶狀圖上的迴歸線性擬合#

使用的 seaborn 組件: set_theme()
, load_dataset()
, catplot()
, regplot()
import seaborn as sns
sns.set_theme()
mpg = sns.load_dataset("mpg")
sns.catplot(
data=mpg, x="cylinders", y="acceleration", hue="weight",
native_scale=True, zorder=1
)
sns.regplot(
data=mpg, x="cylinders", y="acceleration",
scatter=False, truncate=False, order=2, color=".2",
)