使用散景时如何设置数字的标题字体大小?
我试过(在ipython笔记本中):
import bokeh.plotting as bp
import numpy as np
bp.output_notebook()
x_points = np.random.rand(100)
y_points = np.random.rand(100)
bp.figure(title='My Title', x_axis_label='X axis', y_axis_label='Y axis', \
text_font_size='8pt')
bp.scatter(x_points, y_points)
bp.show()
我尝试过text_font_size,label_text_font,title_font_size等。 文档中的所有信息都在哪里?
答案 0 :(得分:16)
Plot属性title_text_font_size
在0.12.0中已弃用,将被删除。从散景版0.12.0开始,应该使用Plot.title.text_font_size
代替。更新的示例如下:
import numpy as np
import bokeh.plotting as bp
bp.output_notebook()
x_points = np.random.rand(100)
y_points = np.random.rand(100)
p = bp.figure(title='My Title', x_axis_label='X axis', y_axis_label='Y axis')
p.title.text_font_size = '8pt'
p.scatter(x_points, y_points)
bp.show(p)
您可以类似地更改轴标签的字体大小:
p.xaxis.axis_label_text_font_size = "20pt"
p.yaxis.axis_label_text_font_size = "20pt"
答案 1 :(得分:10)
我明白了。你需要预先添加标题_'到' text_font_size'
import bokeh.plotting as bp
import numpy as np
bp.output_notebook()
x_points = np.random.rand(100)
y_points = np.random.rand(100)
bp.figure(title='My Title', x_axis_label='X axis', y_axis_label='Y axis', \
title_text_font_size='8pt')
bp.scatter(x_points, y_points)
bp.show()