Leehbi Leehbi - 29 days ago 9
Python Question

Change the text size of Bokeh label annotations

I'm adding label annotations to Bokeh bar chart :

labels = LabelSet(x='stock', y='area', text='roomsavailable', level='glyph',
x_offset=-15, y_offset=-13.5, source=source, render_mode='canvas')

p.add_layout(labels)


Does anyone know if it's possible to adjust the size of the text?

Answer Source

In the docs it describes the text_font_size attribute:

The text font size values for the text.

So try something like

YOUR_FONT_SIZE = 10
labels = LabelSet(x='stock',
                  y='area',
                  text='roomsavailable',
                  text_font_size=YOUR_FONT_SIZE,
                  level='glyph',
                  x_offset=-15,
                  y_offset=-13.5,
                  source=source,
                  render_mode='canvas')