在python中使用bokeh
绘图包时,我遇到了一个看似简单的问题。
我想从通常的图形构造函数外部设置bokeh图形的标题,但我得到了一个奇怪的错误。
下面是代码。
from bokeh.plotting import figure
p = figure()
p.title = 'new title'
但是当我尝试这段代码时,我得到一条错误消息:
ValueError: expected an instance of type Title, got new plot of type str
因此,我似乎需要创建一个Title
对象或其他东西来传递给图形。然而,在bokeh documentation中没有提到如何设置标题。这里只提到如何更改标题字体或标题颜色等。
有谁知道如何在通常的figure(title='new title')
之外设置绘图的标题
发布于 2018-07-13 02:00:30
要简单地更改标题而不构造新的Title
对象,您可以设置图形的title.text
属性:
from bokeh.plotting import figure
p = figure()
p.title.text = 'New title'
https://stackoverflow.com/questions/47733953
复制相似问题