当 x_partial 不是 None 时, lmplot 不会调整 xlim
作者: hchau630创建于 2026年9月18日更新于 2026年9月18日
以下代码
导入熊猫为 pd
导入海生为 sns
将 matplotlib.pyplot 导入为 plt
df = p.DataFrame ({"x": [1.0, 2.0, 3.0, 4.0, 5.0", "y": [1.5, 4.2, 5.8, 8.6, 11.0], "z": [0.0, 2.0, 3.0, 3.5, 4.0]]).
sns.lmplot(df,x="x",y="y",x 部分="z").
plt.show () (中文(简体) ).生成下图
<img宽="489"高="486" alt="Image" src="https://GitHub.com/user-attachments/assets/59ef7656-9ac6-4806-9f51-f1d05ad6fb53"/".
这与“sns.regplot(df, x="x", y="y", x partic="z")”相对,后者的产量
<img宽="399"高="309" alt="Image" src="https://GitHub.com/user-attachments/assets/c8632783-3f46-4049-af98-a1f7a5bdfd3"/".
正确设置 x 轴。 有趣的是,Y Percial没有出现同样的问题.
内容来源: mwaskom/seaborn