Starting from 0.3, krisk support waterfall chart and barline chart.
In [21]:
import numpy as np
import pandas as pd
import krisk.plot as kk
from krisk import init_notebook; init_notebook()
Out[21]:
In [8]:
np.random.seed(0)
df = pd.DataFrame({'val': -1 + 10 * np.random.randn(10)})
In [9]:
df.head()
Out[9]:
In [10]:
kk.waterfall(df['val'])
Out[10]:
You can differentiate the increase and decrease for each of the bar as shown below.
In [11]:
kk.waterfall(df['val'], color_coded=True, annotate="outside", up_name="up")
Out[11]:
Barline is used to merged line and bar series as one chart, with same category. And here's what bar_line
looks like.
In [15]:
url = 'http://www.stat.ubc.ca/~jenny/notOcto/STAT545A/examples/gapminder/data/gapminderDataFiveYear.txt'
gapminder = (pd.read_csv(url,sep='\t')
.groupby(['year','continent'], as_index=False)
.first())
In [16]:
gapminder.head()
Out[16]:
In [17]:
kk.bar_line(gapminder, 'continent', 'lifeExp', 'gdpPercap')
Out[17]:
If you do know that you're data is distinct (category axis, bar/line values) and doesn't need aggregation, you can use is_distinct
method to avoid any aggregation method used in default method.
In [19]:
kk.bar_line(gapminder, 'continent', 'lifeExp', 'gdpPercap', is_distinct=True)
Out[19]: