散景线图,有没有办法将线条颜色设置为渐变?

Bokeh line graph, Is there a way to set the line color as gradient?

我有一个非常简单的意大利面条图,如下所示:enter image description here

我想将线条颜色设置为渐变。 有谁知道这是否可能? 我找了一个小时也没找到解决方案...

这是我的部分代码:

p = figure(title="stabilogram", x_axis_label='time', y_axis_label='position', plot_width=900, plot_height=900)
p.line(x='posX', y='posY', line_width=2, source=df_trial)
show(p)

从 Bokeh 2.3.1 开始,没有选项可以将线条阴影设置为单一颜色以外的任何颜色。最接近的解决方法是将您的线分成多个部分(可以用 segments 绘制),并分别设置它们的颜色。