如何放大seaborn/matplotlib中的直方图? [英] How to zoom in a histogram in seaborn/matplotlib?

查看:80
本文介绍了如何放大seaborn/matplotlib中的直方图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个看起来像这样的直方图:

I produced a histogram which looks something like this:

我用来生成该图的代码:

Code that I used to produce this plot:

sns.countplot(table.column_name)

您会注意到,由于数据分布不均,整个直方图在左端聚集.

As you can notice, the entire histogram gets clustered at the left end due to uneven distribution of data.

如何在最左端放大?

我尝试过的一种使它略胜一筹的方法是:

One way that I tried and it gave me a marginally better result was :

plt.xlim(0,25)

有更好的方法吗?

推荐答案

看起来数据最好以对数刻度显示.在您的matplotlib绘图轴上, ax ,使用:

Looks like the data would be better viewed on a logarithmic scale. On your matplotlib plot axis, ax, use:

ax.set_yscale('log')

这篇关于如何放大seaborn/matplotlib中的直方图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆