这是一个简单的bokeh“快速入门”示例:
"最初的回答",这是故意的吗?
最初的回答:
from bokeh.plotting import Figure
output_file("lines.html")
xs = [1, 2, 3, 4, 5]
ys = [6, 7, 2, 4, 5]
p = Figure()
p.line(xs, ys, legend="Temp.", line_width=2)
show(p)
这个有效。 现在,如果我继承Figure类,脚本仍然可以正常运行并生成HTML页面,但是浏览器只会显示一个空白页面:
from bokeh.plotting import Figure
class TestFigure(Figure):
def __init__(self):
super().__init__()
output_file("lines.html")
xs = [1, 2, 3, 4, 5]
ys = [6, 7, 2, 4, 5]
p = TestFigure()
p.line(xs, ys, legend="Temp.", line_width=2)
show(p)
"最初的回答",这是故意的吗?