情节不与散景一起显示 [英] Plots do not show with bokeh
本文介绍了情节不与散景一起显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用Bokeh和python将报告导出为HTML.谁能告诉我,为什么我的代码不起作用?我尝试打印一个简单的Div并成功,但是一旦包含绘图,浏览器仍然会打开,但是看不到任何内容.不能继承图吗?
i am trying to export a report as HTML using Bokeh with python. Can anybody tell me, why my code is not working? I tried to print a simple Div and succeeded, but as soon as i include plots, the browser still opens, but nothing is visible. Is it not possible to inherit Figure?
我将其简化为相关部分:
I reduced it to the relevant parts:
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
类的主体.
但是我建议不要扩展Bokeh对象,除非您想通过编写自定义JavaScript/TypeScript实现来提供一些UI行为.
But I would advise against extending Bokeh objects unless you want to provide some UI behavior by writing custom JavaScript/TypeScript implementation.
这篇关于情节不与散景一起显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文