编辑散景段落小部件的字体大小/样式

时间:2016-08-02 10:50:35

标签: python pandas fonts bokeh

过去一周我一直在与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)

我意识到在整个网格图中没有办法(在那里?)为散景内的页面/标签设置标题。所以我插入了段落(第5段/第6段)。这很有效,除了文本是Times New Roman,我希望它是另一种字体,比如Arial,并且它是粗体和下划线。

我尝试了title2.text_font_style = 'arial'这样的事情但是没有用。

根据文件(http://bokeh.pydata.org/en/latest/docs/user_guide/interaction/widgets.html#paragraph),段落没有这种属性。

是否有设置段落小部件字体的迂回方式?

提前致谢

1 个答案:

答案 0 :(得分:0)

尝试改用Div小部件:

  

Div

     

用于显示可在标记中支持HTML的文本的小部件:

     

...