How to zoom in a histogram in seaborn/matplotlib?

一曲冷凌霜 提交于 2021-01-28 23:20:55

问题


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.

How do I zoom in at the left end?

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

plt.xlim(0,25)

Is there a better way to do this?


回答1:


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

ax.set_yscale('log')


来源:https://stackoverflow.com/questions/39949841/how-to-zoom-in-a-histogram-in-seaborn-matplotlib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!