How can I add text annotation in Bokeh?

匆匆过客 提交于 2021-02-18 11:36:09

问题


I'm looking for Matplotlib type 1 text annotation in Bokeh, but I couldn't find it in the their user guide 2 or in the references.


回答1:


As of version 0.12.2, to add text annotations you would use the "label" glyph.

from bokeh.models import Label

p = figure(...)

mytext = Label(x=70, y=70, text='here your text')

p.add_layout(mytext)

show(p)

Please find a full example in the documentation: http://docs.bokeh.org/en/latest/docs/user_guide/annotations.html#userguide-annotations




回答2:


This 'text' functionality falls under 'glyphs': you'll find the page here



来源:https://stackoverflow.com/questions/30696486/how-can-i-add-text-annotation-in-bokeh

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!