With krisk, you also can customize color and themes.


In [2]:
import krisk.plot as kk
import pandas as pd
# Use this when you want to nbconvert the notebook (used by nbviewer)
from krisk import init_notebook; init_notebook()


Out[2]:

In [3]:
df = pd.read_csv('../krisk/tests/data/gapminderDataFiveYear.txt', sep='\t').sample(50)

Themes

There are currently six possible themes in krisk, as supported by Echarts. Here I will show you simple chart using each of theme.

For more intutitive about them, please visit http://echarts.baidu.com/download-theme.html

Normal


In [4]:
p = kk.bar(df,'year',c='continent',stacked=True)
p


Out[4]:

Vintage


In [5]:
p.set_theme('vintage')


Out[5]:

Dark


In [6]:
p.set_theme('dark')


Out[6]:

Macarons


In [7]:
p.set_theme('macarons')


Out[7]:

Infographic


In [8]:
p.set_theme('infographic')


Out[8]:

Roma


In [9]:
p.set_theme('roma')


Out[9]:

Shine


In [10]:
p.set_theme('shine')


Out[10]:

Colors (Palette and Background)

Krisk doesn't have existing based colormap. But you can feed CSS Color Codes, hex, or RGB colors manually.


In [48]:
pallete = ['Navy','#FF0000','rgb(205,92,92)', '#65c3bf','hsl(60, 100%, 87%)']
p.set_color(background='Aqua', palette=pallete)


Out[48]:

You also can using existing palettes provided by visualization libraries you already know. Here I will use libraries like Seaborn, Colorlover, and Bokeh.


In [11]:
import seaborn as sns

In [47]:
palette_sns1 = sns.color_palette('muted').as_hex()
p.set_color(palette=palette_sns1)


Out[47]:

Seaborn also nicely integrate colormap from matplotlib


In [14]:
palette_sns2 = sns.color_palette('YlGnBu').as_hex()
p.set_color(palette=palette_sns2)


Out[14]:

In [15]:
import colorlover as cl

In [16]:
cl2 = cl.to_hsl( cl.scales['3']['div']['RdYlBu'] )
p.set_color(palette=cl2)


Out[16]:

In [17]:
import bokeh.palettes as bp
import bokeh.colors as bc

In [18]:
p.set_color(background=bc.aliceblue.to_hex(),palette=bp.PuBuGn6)


Out[18]: