import numpy import matplotlib.pyplot as plt N = 100 tau = 1 # parameter exp. distribuce x = numpy.random.exponential(tau,N) # pole náhodných čísel # automatický histogram: nBins = 10 plt.hist(x, nBins) plt.xlabel("x"); # popiska osy x plt.show() # jde zadat pevné minimum a maximum plt.hist(x, nBins, range=(0, 5*tau)) plt.show() n, bins, patches = plt.hist(x, nBins) # funkce vrací 3 entity plt.show() # n: pole četností (výšek sloupců), bins: pole hranic binů, patches: nevím for i in range(nBins): # můžeme zkusit vypsat obsah binů: print("bin [" + str(bins[i]) + ", " + str(bins[i+1]) + ") případů: " + str(n[i]))