Search code examples
pythonmatplotlibbins

How to change number of bins in matplotlib?


I have the following code:

ax1.hist(true_time, bins=500, edgecolor="none")
ax2.hist(true_time_2, bins=500, edgecolor="none")

I expected that it would give me two hists with the same number of bins, but it wouldn't: enter image description here

How to do it correctly?


Solution

  • If you have some distant outlier in true_time, it may be that the bins were made just really really big to include it.