散景图:'NoneType'对象没有属性'line'

Wil*_*ler 4 python plot bokeh

我刚安装了最新版的Anaconda.

从这个例子中我对Bokeh有一个基本问题.

from bokeh.plotting import *
f = figure()
f.line(x, y)

AttributeError: 'NoneType' object has no attribute 'line'
Run Code Online (Sandbox Code Playgroud)

我可以通过说行(x,y)来绘图,但看起来上面的方法如果能够提供更多的灵活性.

Eri*_*got 8

这个例子(甚至用户指南)违背了文件bokeh.plotting.figure(),其中明确表示,它返回None,这说明你观察到的错误.

line()因此,直接使用似乎是要走的路.

但是,这适用于0.7之前的散景版本:0.7版本已弃用隐式绘图.这意味着figure().line()应该使用散景0.7+.该文档figure()显然尚未更新.