有没有办法用散景绘制不同长度的线条?
Is there any way to plot lines of different lengths with bokeh?
按照建议,降低采样率和调整大小对我来说都不是可行的选择。
我试图用 NaN 填充较短的列表,但这也引发了错误。
有什么解决办法吗?
我的代码看起来像这样:
from bokeh.charts import output_file, Line, save
lines=[[1,2,3],[1,2]]
output_file("example.html",title="toy code")
p = Line(lines,plot_width=600,plot_height=600, legend=False)
save(p)
但是,如下所示,您可以绘制两条不同长度的线。
上的 Bokeh 用户指南
from bokeh.plotting import figure, output_file, show
output_file("patch.html")
p = figure(plot_width=400, plot_height=400)
p.multi_line([[1, 3, 2], [3, 4, 6, 6]], [[2, 1, 4], [4, 7, 8, 5]],
color=["firebrick", "navy"], alpha=[0.8, 0.3], line_width=4)
show(p)
按照建议
有什么解决办法吗? 我的代码看起来像这样:
from bokeh.charts import output_file, Line, save
lines=[[1,2,3],[1,2]]
output_file("example.html",title="toy code")
p = Line(lines,plot_width=600,plot_height=600, legend=False)
save(p)
但是,如下所示,您可以绘制两条不同长度的线。
上的 Bokeh 用户指南from bokeh.plotting import figure, output_file, show
output_file("patch.html")
p = figure(plot_width=400, plot_height=400)
p.multi_line([[1, 3, 2], [3, 4, 6, 6]], [[2, 1, 4], [4, 7, 8, 5]],
color=["firebrick", "navy"], alpha=[0.8, 0.3], line_width=4)
show(p)