Bokeh DeprecationWarning:不推荐将固定字体大小值设置为字符串 'text_font_size'

Bokeh DeprecationWarning: Setting a fixed font size value as a string 'text_font_size' is deprecated

/Library/Python/2.7/site-packages/bokeh/properties.py:363: DeprecationWarning: Setting a fixed font size value as a string 'text_font_size' is deprecated, set with value('text_font_size') or ['text_font_size'] instead super(HasProps, self).setattr(name, value)

我在 运行 此代码时收到此警告:

myfig.text(x=[i], y=[.5], text=["abc"], text_align='center', text_font_size=['10pt'], text_color='#CDEFCC')

你能帮忙吗?我该如何摆脱它?

看起来这是 Bokeh 的一个活跃错误。有一个GitHub issue about it。这是响应的片段:

Hi @marcomayer looks like you found a little bug. The "list" syntax may go away anyway. You can set values like this, however:

from bokeh.properties import value
p.axis.major_label_text_font_size=value("8pt")

For a little context, the reason for the deprecation is that string values for data specs are, in every other context, interpreted as column data source column names. This changes brings consistency to the interface.