In [19]:
from ggplot import *
%matplotlib inline
import pandas as pd
import numpy as np
In [10]:
pigeons.head()
Out[10]:
In [13]:
ggplot(pigeons, aes(x='pos', y='speed')) + geom_line()
Out[13]:
In [14]:
ggplot(pigeons, aes(x='pos', y='speed')) + geom_step()
Out[14]:
In [17]:
ggplot(pigeons.head(25), aes(x='pos', y='speed')) + geom_step(direction='hv')
Out[17]:
In [18]:
ggplot(pigeons.head(25), aes(x='pos', y='speed')) + geom_step(direction='vh')
Out[18]:
In [25]:
random_walk = pd.DataFrame(dict(
x=np.arange(100),
y=np.random.choice([-1, 1], 100).cumsum()
))
random_walk.head()
Out[25]:
In [26]:
ggplot(random_walk, aes(x='x', y='y')) + geom_point()
Out[26]:
In [27]:
ggplot(random_walk, aes(x='x', y='y')) + geom_point() + geom_step()
Out[27]:
In [31]:
ggplot(random_walk, aes(x='x', y='y')) + geom_line(color='coral') + geom_step(color='steelblue')
Out[31]:
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]:
In [34]:
ggplot(random_walk, aes(x='x', y='y', color='project')) + geom_step()
Out[34]:
In [38]:
ggplot(random_walk, aes(x='x', y='y', color='project')) + geom_step(size=5)
Out[38]:
In [ ]: