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
4

2 回答 2

0

接受的答案有点过时,因为bokeh.charts已弃用(使用什么代替 bokeh.charts),您可以使用使用颜色图的 Holoviews,如下所述:http: //holoviews.org/user_guide/Colormaps.html

于 2019-02-19T14:10:09.497 回答
0

Chord 不使用调色板,它使用这样的色轮:

在此处输入图像描述

于 2017-05-27T10:39:40.693 回答