gpt4 book ai didi

python - 调整 Bokeh 图的标题字体大小

转载 作者:行者123 更新时间:2023-12-03 23:08:56 25 4
gpt4 key购买 nike

使用bokeh时如何设置图形的标题字体大小?

我试过了(在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等。
所有这些信息在文档中的哪里?

最佳答案

绘图属性title_text_font_size在0.12.0中已弃用,将被删除。从bokeh版本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"

关于python - 调整 Bokeh 图的标题字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27405964/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com