For future reference - when you say “does not work” please provide the details.
For the above code, assuming you’re running the latest Bokeh version, you should’ve received this error (truncated for brevity):
ValueError: expected an element of either Enum(…), Regex(…), Tuple(…) or RGB, got ‘color’
The docstring of the
Line class says:
Line glyph is different from most other glyphs in that the vector
of values only produces one glyph on the Plot.
Lines don’t support vectors for anything other than
y. That’s because it’s unclear what to do when different points have different values for such fields. Let’s continue looking at the
color property, assume we want the following code to work:
p.line(x=[0, 1], y=[0, 1], color=['red', 'blue'])
There are two dots and the line connects them. But how should the line be colored? Full red, full blue, purple, half red and half blue length-wise, half red and half blue width-wise, striped,…? Of course, there could be another property for that, but IMO that would drastically overcomplicate a relatively simple glyph for a very rare use-case that’s often covered by the