更改python bokeh PreText()的颜色

2024-06-16 10:03:41 发布

您现在位置:Python中文网/ 问答频道 /正文

有没有办法改变字体或颜色

在bokeh.models.widgets.加价.借口在

from bokeh.models.widgets import PreText
from bokeh.plotting import show

mytext = PreText()
mytext.text = "Text in black"
show(mytext)

Tags: textfromimport颜色modelsshowbokeh字体
1条回答
网友
1楼 · 发布于 2024-06-16 10:03:41

Bokeh标记映射到HTML元素,因此可以通过关键字style将样式绑定到它。像这样:

mytext = PreText(text="Text in black", style={'color': 'black'})

还要注意,PreText映射到<pre>标记,该标记用于预格式化文本,通常用于显示代码。根据您想要显示的内容,段落将更合适。在

您可以检查使用Bokeh和应用样式的documentation heresimilar question。在

相关问题 更多 >