commit
dc1c23b2e1
@ -2339,7 +2339,7 @@
|
|||||||
"def repeated_hist(dist, n=10**6, bins=100):\n",
|
"def repeated_hist(dist, n=10**6, bins=100):\n",
|
||||||
" \"Sample the distribution n times and make a histogram of the results.\"\n",
|
" \"Sample the distribution n times and make a histogram of the results.\"\n",
|
||||||
" samples = [dist() for _ in range(n)]\n",
|
" samples = [dist() for _ in range(n)]\n",
|
||||||
" plt.hist(samples, bins=bins, normed=True)\n",
|
" plt.hist(samples, bins=bins, density=True)\n",
|
||||||
" plt.title('{} (μ = {:.1f})'.format(dist.__name__, mean(samples)))\n",
|
" plt.title('{} (μ = {:.1f})'.format(dist.__name__, mean(samples)))\n",
|
||||||
" plt.grid(axis='x')\n",
|
" plt.grid(axis='x')\n",
|
||||||
" plt.yticks([], '')\n",
|
" plt.yticks([], '')\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user