Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the text size of Bokeh label annotations

Tags:

python

bokeh

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?

like image 426
Leehbi Avatar asked Sep 23 '17 13:09

Leehbi


People also ask

How to annotate a bokeh plot?

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.

How to change the size of the labels using bokeh legend?

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.

How do I add additional information to a bokeh visualization?

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:

How to customize a glyph in bokeh?

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.


1 Answers

text_font_size takes in a string value like YOUR_FONT_SIZE = '10pt'

like image 125
Johnathan Huggett Avatar answered Nov 10 '22 11:11

Johnathan Huggett