Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bokeh plotting: 'NoneType' object has no attribute 'line'

Tags:

python

plot

bokeh

I've just installed the latest version of Anaconda.

I am having a basic problem with Bokeh, from this example.

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

AttributeError: 'NoneType' object has no attribute 'line'

I can plot by saying line(x,y), but it looks like the above method would provide more flexibility if it worked.

like image 929
Mr. W. Avatar asked Feb 12 '23 09:02

Mr. W.


1 Answers

The example (and even the user guide) contradict the documentation for bokeh.plotting.figure(), which explicitly says it returns None, which explains the error you observe.

Using line() directly therefore seems to be the way to go.

However, this holds for bokeh versions before 0.7: version 0.7 deprecated implicit plotting. This means that figure().line() should work with bokeh 0.7+. The documentation for figure() has apparently not yet been updated.

like image 75
Eric O Lebigot Avatar answered Feb 16 '23 04:02

Eric O Lebigot