调整 Bokeh 段落窗口小部件的字体大小/样式

3

我最近一周一直在使用Bokeh,但有一件事我似乎做不到。

这是我的脚本的一部分:

data5 = dict(depth = df4['Depth'], length = df4['Length'], recovery = df4['Recovery'], peak = df4['Peak'], valley = df4['Valley'], exitdate = df4['Exit Date'])
data6 = dict(returns = df5['Return'], correlation = df5['Correlation'])

source5 = ColumnDataSource(data5)
source6 = ColumnDataSource(data6)

columns5 = [TableColumn(field = 'depth', title = 'Depth'), TableColumn(field = 'length', title = 'Length (Months)'), 
            TableColumn(field = 'recovery', title = 'Recovery (Months)'), TableColumn(field = 'peak', title = 'Peak'),
            TableColumn(field = 'valley', title = 'Valley'), TableColumn(field = 'exitdate', title = 'Exit Date')]
columns6 = [TableColumn(field = 'returns', title = 'Return'), TableColumn(field = 'correlation', title = 'Correlation')]           

table5 = DataTable(source = source5, columns = columns5, width = 700, height = 350, editable = False)
table6 = DataTable(source = source6, columns = columns6, width = 400, height = 300, editable = False)

para5 = Paragraph(text = 'Portfolio', height = 1)
para6 = Paragraph(text = 'Benchmark', height = 1)

title2 = Paragraph(text = 'Drawdown Review (Since Sep 2011)', height = 1)

t2 = vplot(vform(para5), vform(table5)) 
t3 = vplot(vform(para6), vform(table6))
t4 = hplot(t2, t3)
q5 = vplot(vform(title2), t4)

tab0 = Panel(child = q0, title = 'Rolling Statistics')
tab1 = Panel(child = q1, title = 'Up-Down Capture')
tab2 = Panel(child = q2, title = 'Historical Statistics')
tab3 = Panel(child = q3, title = 'Historical Track Record')
tab4 = Panel(child = q4, title = 'Historical Analysis')
tab5 = Panel(child = q5, title = 'Drawdown Review')

tabs = Tabs(tabs = [tab3, tab4, tab5, tab0 ,tab1, tab2])
bk.io.show(tabs)

我发现在整个gridplot中为页面/选项卡设置标题的方法(是否有这种方法?)在bokeh中无法实现。所以我插入了段落(para5/para6)。这很好用,但文字是Times New Roman字体,我想使用另一种字体,比如Arial,并使其加粗和带下划线。
我尝试过title2.text_font_style = 'arial'之类的操作,但没有成功。
根据文档,段落没有这种属性。
有没有绕开设置段落小部件字体的间接方法?
提前致谢
1个回答

0

尝试使用Div小部件代替:

Div

用于显示文本的小部件,可以支持HTML标签:

...


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接