```# HIDDEN
from scipy import stats
from datascience import *

import numpy as np
import math
import ipywidgets
import nbinteract
```

### Probability Distribution Plots¶

This example shows how to create interactive probability distribution demos using `nbinteract.bar` method.

#### Binomial Distribution¶

```# Although this function doesn't appear necessary, the scipy stats functions
# don't explicitly require n and p as args which causes issues with interaction
def binom_pmf(xs, n, p):
return stats.binom.pmf(xs, n, p)

options = {
'xlabel': 'X',
'ylabel': 'probability',
'ylim': (0, 1),
}

nbinteract.bar(np.arange(21), binom_pmf, options=options,
n=(0, 20), p=(0.0, 1.0))
```

#### Geometric Distribution¶

```def geom_pmf(xs, p): return stats.geom.pmf(xs, p)
nbinteract.bar(np.arange(20), geom_pmf, options=options, p=(0.0,1.0))
```

#### Poisson Distribution¶

```def poisson_pmf(xs, mu): return stats.poisson.pmf(xs, mu)
nbinteract.bar(np.arange(20), poisson_pmf, options=options, mu=(0, 10))
```