In [19]:
from ggplot import *
%matplotlib inline
import pandas as pd
import numpy as np

In [10]:
pigeons.head()


Out[10]:
pos breeder pigeon name color sex ent arrival speed to_win eligible
0 1 Texas Outlaws 19633-AU15-FOYS NaN BCWF H 1 42:14.0 172.155 0:00:00 Yes
1 2 Junior Juanich 0402-AU15-JRL NaN SIWF H 1 47:36.0 163.569 0:05:21 Yes
2 3 Jerry Allensworth 0404-AU15-VITA Perch Potato BB H 1 47:41.0 163.442 0:05:27 Yes
3 4 Alias-Alias 2013-AU15-ALIA NaN BBSP H 1 47:43.0 163.392 0:05:28 Yes
4 5 Greg Glazier 5749-AU15-SLI NaN BC H 1 47:44.0 163.366 0:05:30 Yes

In [13]:
ggplot(pigeons, aes(x='pos', y='speed')) + geom_line()


Out[13]:
<ggplot: (288454005)>

In [14]:
ggplot(pigeons, aes(x='pos', y='speed')) + geom_step()


Out[14]:
<ggplot: (288579529)>

In [17]:
ggplot(pigeons.head(25), aes(x='pos', y='speed')) + geom_step(direction='hv')


Out[17]:
<ggplot: (290497257)>

In [18]:
ggplot(pigeons.head(25), aes(x='pos', y='speed')) + geom_step(direction='vh')


Out[18]:
<ggplot: (293747037)>

In [25]:
random_walk = pd.DataFrame(dict(
    x=np.arange(100),
    y=np.random.choice([-1, 1], 100).cumsum()
))
random_walk.head()


Out[25]:
x y
0 0 -1
1 1 -2
2 2 -1
3 3 -2
4 4 -1

In [26]:
ggplot(random_walk, aes(x='x', y='y')) + geom_point()


Out[26]:
<ggplot: (294112189)>

In [27]:
ggplot(random_walk, aes(x='x', y='y')) + geom_point() + geom_step()


Out[27]:
<ggplot: (290513349)>

In [31]:
ggplot(random_walk, aes(x='x', y='y')) + geom_line(color='coral') + geom_step(color='steelblue')


Out[31]:
<ggplot: (295363765)>

In [33]:
random_walk = pd.DataFrame(dict(
    x=np.arange(250),
    y=np.random.choice([-1, 1], 250).cumsum(),
    project=np.random.choice(["Alpha", "Zalpha"], 250)
))
random_walk.head()


Out[33]:
project x y
0 Zalpha 0 -1
1 Alpha 1 0
2 Zalpha 2 1
3 Alpha 3 0
4 Alpha 4 -1

In [34]:
ggplot(random_walk, aes(x='x', y='y', color='project')) + geom_step()


Out[34]:
<ggplot: (295523493)>

In [38]:
ggplot(random_walk, aes(x='x', y='y', color='project')) + geom_step(size=5)


Out[38]:
<ggplot: (297382089)>

In [ ]: