yhat/ggplot — pull request #170 by EricChiang (2014-01-21 18:10:56+00:00)
Title: stat_function added

stat function added

Sorry but I've lost track of the test standards (it's been a while since I contributed). Anyone want to point me to documentation?

```
from ggplot import *
import pandas as pd
import numpy as np

n = 100
x = np.random.randn(n)
fun = lambda x: x*5
y = x * 5
y += np.random.randn(n)

data = pd.DataFrame({'x':x,'y':y})

pp = ggplot(aes(x='x',y='y'),data=data) + geom_point()
pp = pp + stat_function(aes(fun=fun))

print(pp)
```
![x _times_5](https://f.cloud.github.com/assets/2342749/1966350/1364ea3c-82c7-11e3-92da-37c81d692377.png)

```
from ggplot import *
import pandas as pd
import numpy as np

n = 100
x = np.random.normal(size=(n))
def pdf(x):
return (1.0 / np.sqrt(2 * np.pi)) * (np.e ** (-0.5 * (x ** 2)))
data = pd.DataFrame({'x':x})

pp = ggplot(aes(x='x'),data=data) + geom_density()
pp = pp + stat_function(aes(fun=pdf))

print(pp)
```

![pdf](https://f.cloud.github.com/assets/2342749/1966345/0e1ae9b4-82c7-11e3-8d59-b47a7d28f7b8.png)