有没有办法改变字体或颜色
bokeh.models.widgets.markups.PreText
from bokeh.models.widgets import PreText
from bokeh.plotting import show
mytext = PreText()
mytext.text = "Text in black"
show(mytext)
散景标记映射到HTML元素,因此您可以通过关键字style
将样式绑定到它。像这样:
mytext = PreText(text="Text in black", style={'color': 'black'})
另请注意,PreText
映射到<pre>
标记,该标记用于预格式化文本,通常用于显示代码。根据您想要显示的内容,段落更合适。
您可以检查documentation here以及使用散景和应用风格的similar question。