简体   繁体   中英

python histogram with log scale on both x and y axes

I'm trying to plot a histogram of a list of 48103 positive integers, ranging from 1 to over 400,000. If I use the default settings, I get the following thoroughly unhelpful plot:

在此处输入图片说明

The following question explains how to make the x-axis logarithmic: plotting a histogram on a Log scale with Matplotlib

But I don't think that will be enough. I need to make the y-axis logarithmic too.

How do I do that?

Thanks

Ok, this works:

plt.hist(data,bins=[1,10,100,1000,10000,100000,1000000])
plt.xscale('log')
plt.yscale('log')
plt.show()```

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM