Search code examples
python-2.7chartsbokehchord-diagram

Changing size and color of labels in Bokeh high level charts


Is there a way to change or manipulate the font size and color of the labels in Bokeh high level charts like the Chord chart?

Bokeh provides options to change the background color etc, but I cannot seem to find any means to tweak the labels either in Bokeh or in css.

Any help or suggestion would be greatly appreciated.


Solution

  • In order to change the text size and color you have to alter the glyphs inside the chord chart renderers. The renderer in index position 3 is the text glyph renderer so you can set the font size and color there.

    chord_from_df = Chord(source_data, source="name_x", target="name_y", value="value")
    chord_from_df.renderers[3].glyph.text_font_size['value'] = '12pt'
    chord_from_df.renderers[3].glyph.text_color = '#FF0000'
    show(chord_from_df)