散景人物的字体属性(例如,字体大小)全包

时间:2019-04-24 18:39:53

标签: python bokeh

我知道我可以访问单个模型/注释的字体大小,例如p.axis.major_label_text_font_size。例如,如果我想更改整个图形中的所有字体大小和所有字体样式,那么很快就会变成很多代码(图例,轴标签和刻度标签,图,标题等)。有没有办法像这样访问/设置字体大小?

1 个答案:

答案 0 :(得分:0)

据我所知,最好的选择是使用Bokeh themes

有内置主题,但您也可以定义自己的主题,将其保存为YAML或JSON格式,然后动态加载它们并在它们之间进行切换,如下所示:

theme1 = Theme(filename = os.path.join(os.path.dirname(__file__), 'templates/theme1.yaml'))
theme2 = Theme(filename = os.path.join(os.path.dirname(__file__), 'templates/theme2.yaml'))

curdoc().theme = theme1
curdoc().theme = theme2

另请参阅this post

相关问题