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]:
val
0 16.640523
1 3.001572
2 8.787380
3 21.408932
4 17.675580

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]:
year continent country pop lifeExp gdpPercap
0 1952 Africa Algeria 9279525.0 43.077 2449.008185
1 1952 Americas Argentina 17876956.0 62.485 5911.315053
2 1952 Asia Afghanistan 8425333.0 28.801 779.445314
3 1952 Europe Albania 1282697.0 55.230 1601.056136
4 1952 Oceania Australia 8691212.0 69.120 10039.595640

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]: