Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change text font size in Bokeh LabelSet

I have some plots deployed as a layout using Bokeh Server. For now it is working fine. But when I include the text_font_size attribute in the label set, it does not work anymore.

labels = LabelSet(x='datetime', y='bool_event', text='Code description', level='glyph',
                  x_offset=5, y_offset=5, source=ColumnDataSource(df2), render_mode='canvas',
                  text_font_size=10)

The error I get is the following: Error

The actual layout is the following one: Layout

like image 694
BSP Avatar asked Jan 05 '23 12:01

BSP


1 Answers

You need to give units to your text_font_size. The code should look like this:

  labels = LabelSet(x='datetime', y='bool_event', text='Code description', level='glyph',
              x_offset=5, y_offset=5, source=ColumnDataSource(df2), render_mode='canvas',
              text_font_size="10pt")
like image 141
bourneeoo Avatar answered Jan 12 '23 16:01

bourneeoo