Is there a way to change the font or the color of
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)
Bokeh markups are mapped to HTML elements, therefore you can bind style to it through the keyword style
. Like this:
mytext = PreText(text="Text in black", style={'color': 'black'})
Also notice that the PreText
maps to the <pre>
tag which is used for pre formatted text, normally used to display code, for example. Depending on what you want do display, Paragraph would be more appropriate.
You may check the documentation here and also a similar question of using Bokeh and applying style.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.