Hi,

On Thu, Dec 4, 2014 at 7:01 AM, Dino Bektešević <ljet...@gmail.com> 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.

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to