|
From: Amit S. <ami...@gm...> - 2014-12-15 10:31:02
|
Hi, On Thu, Dec 4, 2014 at 7:01 AM, Dino Bektešević <lj...@gm...> wrote: > Hello, > > try doing: > > import matplotlib.pyplot as plt > import random > > rolls = list() > for i in range(1000): > rolls.append(random.randint(1,6)) > > > plt.hist(rolls, bins=6) > plt.show() > > Reason why your histogram is weird is because you only can have 6 bins > in your example. But the default bin number for hist function is 10. > The borders of bins are therefore set at half intervals. When you roll > 1, bin 0 to 0.6 gets incremented, when you roll 2.2 bin 2-2.6 gets > incremented, but the bin 0.6-2.2 never does. Thanks. That helps me in my understanding. Choosing bins = 6 fixes the problem I reported. Best, Amit. |