Поэтому у меня есть следующий код, который отлично работает:Почему я не могу назвать Bokeh file_html на гистограмме?
from bokeh.plotting import circle
from bokeh.resources import CDN
from bokeh.embed import file_html
plot = circle([1,2], [3,4])
html = file_html(plot, CDN, "my plot")
html
ветры, содержащий HTML строку, которая рисует круг. Однако я не могу сделать то же самое с объектом Bar
.
from bokeh.plotting import circle
from bokeh.resources import CDN
from bokeh.embed import file_html
plot = Bar(OrderedDict(tuples))
html = file_html(plot, CDN, "my plot")
Это терпит неудачу с ошибкой:
Traceback (most recent call last):
File "./viz.py", line 66, in <module>
html = file_html(b, CDN, "my plot")
File "/usr/local/lib/python2.7/dist-packages/bokeh/embed.py", line 120, in file_html
script, div = components(plot_object, resources)
File "/usr/local/lib/python2.7/dist-packages/bokeh/embed.py", line 41, in components
ref = plot_object.ref
AttributeError: 'Bar' object has no attribute 'ref'
Я предполагаю, что Bar
объект не является объектом сюжета. Как я могу включить его в один?