Python 博克多行时间序列图

Python 博克多行时间序列图,python,bokeh,Python,Bokeh,如何在Bokeh中绘制多行时间序列? 我用下面的两对x和y得到了一张没有绘图的空图表: x1 = ['2017-03-15', '2017-03-16', '2017-03-17', '2017-03-18', '2017-03-19'] y1 = [0.02, 0.02, 0.02, 0.01, 0.0] x2 = ['2017-03-20', '2017-03-21', '2017-03-22', '2017-03-23', '2017-03-24'] y2 = [0.23, 0.24,

如何在
Bokeh
中绘制多行时间序列? 我用下面的两对x和y得到了一张没有绘图的空图表:

x1 = ['2017-03-15', '2017-03-16', '2017-03-17', '2017-03-18', '2017-03-19']
y1 = [0.02, 0.02, 0.02, 0.01, 0.0]

x2 = ['2017-03-20', '2017-03-21', '2017-03-22', '2017-03-23', '2017-03-24']
y2 = [0.23, 0.24, 0.25, 0.25, 0.27]

#converting x-axis to datetime
x1 = [datetime.strptime(date, "%Y-%m-%d") for date in x1]
x2 = [datetime.strptime(date, "%Y-%m-%d") for date in x2]

# create a new plot with a title and axis labels
p = figure(title="my Chart", x_axis_label='date', y_axis_label='percentage', x_axis_type='datetime',tools=TOOLS)

p.multi_line(xs = [x1, y1] , ys = [x2, y2], color=['red','green'])

html = file_html(p, CDN, "my plot")

在p.multi_-line方法中,您的xs和ys参数设置不正确

请尝试以下方法:

p.multi_line(xs = [x1, x2] , ys = [y1, y2], color=['red','green'])