New filters on the Home Feed, take a look!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
How to visualize Binomial PDF using ipython notebook and matplotlib
Post Body

I'm having problems visualizing binomial distribution. What I'd like to have is discreet kind of histogram where each one is centered at values 0,1,2,....n and it's height corresponds to binomial pmf. Best I could do is:

%pylab inline --no-import-all
import numpy as np
from scipy.stats import binom
from pylab import *

n = 100
p = 0.5

x = np.array(list(range(0, n   1)))
x
y = binom.pmf(x, n, p)
y

plot(x,y)    

which gives me continuous line. Thank you for helping a newbie out.

Author
Account Strength
80%
Account Age
11 years
Verified Email
Yes
Verified Flair
No
Total Karma
264
Link Karma
129
Comment Karma
135
Profile updated: 3 days ago
Posts updated: 1 year ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
9 years ago