在IPython笔记本中散景失踪的情节

joh*_*ual 5 bokeh jupyter-notebook

我正在运行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()
Run Code Online (Sandbox Code Playgroud)

Pau*_*l H 1

过时的答案:请参阅https://docs.bokeh.org/en/latest/docs/user_guide/plotting.html了解现代 Bokeh



尝试使用figure本例中的命令:

import numpy as np
import bokeh.plotting as bplt
bplt.output_file("bokehtest.html")
x = np.linspace(-2*np.pi, 2*np.pi, 100)
y = np.cos(x)

bplt.figure()
bplt.line(x, y, color="red")
bplt.scatter(x, y, marker="square", color="blue")
bplt.show()
Run Code Online (Sandbox Code Playgroud)