维护者注意:这个问题已经过时了。在figure
上调用多个glyph方法会自动合并(并且已经有很多年了)。有关现代Bokeh的信息,请参见:
https://docs.bokeh.org/en/latest/docs/user_guide/plotting.html
已过时:
我正在IPython笔记本中运行Bokeh教程。它只显示散点图而不是线图。在命令行中,它会渲染两个图表分别。如何在同一个图表上叠加这两个图形?
import numpy as np
import bokeh.plotting as bplt
bplt.output_file("bokehtest.html")
#bplt.output_notebook(url=None)
x = np.linspace(-2*np.pi, 2*np.pi, 100)
y = np.cos(x)
bplt.line(x, y, color="red")
bplt.scatter(x, y, marker="square", color="blue")
bplt.show()