I'm adding label annotations to Bokeh bar chart :
labels = LabelSet(x='roomsavailable', 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?
Annotations are pieces of explanatory text added to the diagram. Bokeh plot can be annotated by way of specifying plot title, labels for x and y axes as well as inserting text labels anywhere in the plot area. Plot title as well as x and y axis labels can be provided in the Figure constructor itself.
Now comes the main implementation i.e changing the size of the labels using bokeh legend. So, by using legend.label_text_font_size we are customizing the size of the labels and glyphs in the box, and since we have given a title to the box, legend.label_text_font_size helps us to change the size of the title.
Bokeh includes several different types of annotations you can use to add supplemental information to your visualizations. Use Title annotations to add descriptive text which is rendered around the edges of a plot. If you use the bokeh.plotting interface, the quickest way to add a basic title is to pass the text as the title parameter to Figure:
Some of the attributes that can be used to customize a glyph: legend.label_text_font, legend.label_text_font_size, legend.location, legend.title, legend.orientation and, legend.clicking_policy. Now, before proceeding further, we must be sure to have bokeh installed on our local device.
text_font_size takes in a string value like YOUR_FONT_SIZE = '10pt'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With