In [3]:
columns = ['Dee Dee', 'Johnny', 'Joey', 'Tommy', 'Marky']
birth_years = [1951, 1948, 1951, 1951, 1956]
death_years = [2002, 2004, 2001, None, None]
In [4]:
import datetime
from pandas import Series
from pandas import DataFrame
from pandas import date_range
todays_date = datetime.datetime.now().date()
index = date_range('1/1/1948', periods=66, freq='A')
d = {}
for i, ramone in enumerate(columns):
if death_years[i]:
years = death_years[i] - birth_years[i] + 1
else:
years = 2013 - birth_years[i] + 1
years_alive = date_range('1/1/%i' % birth_years[i], periods=years, freq='A')
series = Series(1, index=years_alive)
d[ramone] = series
df = DataFrame(d, index=index)
df
Out[4]:
In [5]:
import vincent
vincent.core.initialize_notebook()
stacked = vincent.StackedArea(df)
stacked.axis_titles(x='Year', y='Total Ramones')
stacked.legend(title='Ramones')
stacked.colors(brew='Spectral')
stacked.width=600
stacked.height=400
stacked.display()
In [5]: