What is the right way to pass text_align of LabelSet?

In Bokeh 2.1.0 something seems to have changed regarding how to specify the text_align parameter of the LabelSet component as compared to 2.0.1.

If I specify labels to have center alignment using:
labelset = LabelSet(x=‘x’, y=‘y’, text=‘label’, level=‘overlay’,
source=geo_source, y_offset=-5, x_offset=0,
text_color={‘field’:‘color’}, visible=False,
text_font_size=‘11pt’,
text_align=‘center’)

I get the following error:
bokeh.core.property.bases.DeserializationError: Enum(‘left’, ‘right’, ‘center’) expected str, got {‘value’: ‘center’} of type dict

It seems that ‘center’ is converted somewhere to a dict.

The same error occurs if I do something like this:
labelset.text_align = ‘center’

Is there some special way how I should set the text_align value?

That seems like a bug, please file a GitHub issue.

Just did: [BUG] Unable to set `LabelSet.text_align` with `bokeh serve` · Issue #10181 · bokeh/bokeh · GitHub

2 Likes