如何在Seaborn中绘制分布图?

发布于 2025-02-09 03:05:04 字数 448 浏览 2 评论 0原文

它在历史图中很好,但在散布中并不能很好地吸收。

sns.histplot(df [target])

sns.distplot(df [target])

It comes out well in the histplot, but it doesn't draw well in the distplot.

sns.histplot(df[target])
the histplot looks okay

sns.distplot(df[target])
the distplot is just a flat line

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笑脸一如从前 2025-02-16 03:05:05

请尝试sns.displot(data = df,x =“ target”,kde = true)

sns.displot(data = df,x =“ target”,kint =“ kde” )

Please try sns.displot(data=df, x="target", kde=True)

or sns.displot(data=df, x="target", kind="kde")

挽清梦 2025-02-16 03:05:05

您的X值范围是巨大的! sns.dist()绘制分布概率意味着总和将等于1。因此,从本质上讲,在您的x值的巨大范围内,您的概率值很小。此图和Y图范围是-1至1。如果您更改Y范围,则应该使您更接近您期望看到的东西。

因此,将您的Y量表更改为类似的内容:

sns.distplot(df[target])
plt.ylim(0, .1**27)

Your x range of values is huge! sns.dist() plots the distribution probability meaning the sum will equal to 1. So essentially with this huge magnitude of your x values, you'll have very small probability values. This and your y graph range is -1 to 1. If you change your y range, you should get something closer to what you'd expect to see.

So change your y scale to something like:

sns.distplot(df[target])
plt.ylim(0, .1**27)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文