地块不显示散景
Plots do not show with bokeh
我正在尝试使用 Bokeh 和 python 将报告导出为 HTML。谁能告诉我,为什么我的代码不起作用?我尝试打印一个简单的 Div 并成功了,但是一旦我包含绘图,浏览器仍会打开,但看不到任何东西。是不是不能继承Figure?
我把它缩小到相关部分:
def export_html(self):
plots=[]
plots.append(PlotObject(self.plot_attributes[4]))
VisuLog(plots)
from bokeh.plotting import Figure, show, output_file
class VisuLog():
def __init__(self,plots):
self.plots = plots
filename="Report_"
output_file("visu_out\"+ filename + ".html", title=filename)
show(self.plots) # open a browser
class PlotObject(Figure):
def __init__(self,plot_attributes):
super(PlotObject, self).__init__()
感谢您的帮助。
尝试添加
__subtype__ = 'PlotObject'
__view_model__ = 'Plot'
到 PlotObject
class 的正文。
但我建议不要扩展 Bokeh 对象,除非您想通过编写自定义 JavaScript/TypeScript 实现来提供一些 UI 行为。
我正在尝试使用 Bokeh 和 python 将报告导出为 HTML。谁能告诉我,为什么我的代码不起作用?我尝试打印一个简单的 Div 并成功了,但是一旦我包含绘图,浏览器仍会打开,但看不到任何东西。是不是不能继承Figure?
我把它缩小到相关部分:
def export_html(self):
plots=[]
plots.append(PlotObject(self.plot_attributes[4]))
VisuLog(plots)
from bokeh.plotting import Figure, show, output_file
class VisuLog():
def __init__(self,plots):
self.plots = plots
filename="Report_"
output_file("visu_out\"+ filename + ".html", title=filename)
show(self.plots) # open a browser
class PlotObject(Figure):
def __init__(self,plot_attributes):
super(PlotObject, self).__init__()
感谢您的帮助。
尝试添加
__subtype__ = 'PlotObject'
__view_model__ = 'Plot'
到 PlotObject
class 的正文。
但我建议不要扩展 Bokeh 对象,除非您想通过编写自定义 JavaScript/TypeScript 实现来提供一些 UI 行为。