0

I am using the Bokeh library to generate a chord diagram. The diagram itself generates more-or-less just fine, but I'm having difficulty figuring out how to change the palette. As far as I can gather, most charts in Bokeh can have an optional palette argument, but adding this doesn't change the palette. Am I missing something?

import bokeh
from bokeh.charts import Chord
from bokeh.io import show, output_file
from bokeh.palettes import inferno

chord_diagram = Chord(forchord, source='nameA', target='nameB', palette= inferno(256))
show(chord_diagram)

If some data would help:

nameA_lst = ['Creb5','Creb5','JDP2(var.2)','JDP2(var.2)',
             'Creb5','JDP2(var.2)','ATF7','ATF','ATF7','Creb5']
nameB_lst = ['STAT3','STAT1','STAT3','STAT1','Stat4',
             'Stat4','STAT3','STAT1','Stat4','Stat5a::Stat5b']
forchord = pd.DataFrame({'nameA': nameA_lst, 'nameB': nameB_lst})
forchord.head()
    nameA   nameB
0   Creb5   STAT3
1   Creb5   STAT1
2   JDP2(var.2) STAT3
3   JDP2(var.2) STAT1
4   Creb5   Stat4
Flow Nuwen
  • 547
  • 5
  • 20

2 Answers2

0

Chord doesn't use palette, it use color wheel like this:

enter image description here

HYRY
  • 94,853
  • 25
  • 187
  • 187
0

The accepted answer is a bit outdated as bokeh.charts has been deprecated (What to use instead of bokeh.charts), instead you can use Holoviews which use colormaps, as described here: http://holoviews.org/user_guide/Colormaps.html

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
solaris9
  • 21
  • 2