jupyterウィジェットを使用してbokehでスパンを作成しようとしています。私はこのコードを実行するとJupyterノートブックの対話要素でBokehスパンを更新する
from ipywidgets import interact
import numpy as np
from scipy.stats import norm
from bokeh.sampledata.daylight import daylight_warsaw_2013
from bokeh.io import push_notebook, show, output_notebook
from bokeh.plotting import figure
from bokeh.models import Span
output_notebook()
p = figure()
x_axis = np.arange(-10, 10, 0.001)
# Mean = 0, SD = 2.
y_axis = norm.pdf(x_axis,0,2)
p.line(x_axis, y_axis, line_dash='solid', line_width=2)
cutoff = Span(location=1,
dimension='height', line_color='green',
line_dash='dashed', line_width=2)
p.add_layout(cutoff)
show(p, notebook_handle=True)
def update(new_cutoff_location):
cutoff.location = new_cutoff_location
push_notebook()
interact(update, new_cutoff_location = 1.0)
私はpush_notebook()
でValueError: PATCH-DOC message requires at least one event
を取得します。私はこれがcutoff.location
への更新が検出されていないことを示しているので、送信する変更がないかのように見えます。ハンドルを渡すことで違いはないようです。 this github issueのサンプルコードを見ると、span要素にset
メソッドがあるように見えますが、私のスパン要素cutoff
には存在しません。おそらく、私が変更を登録するために呼び出すはずの別の機能がありますか?
私はこれがボケで回帰ように見えるjupyter 1.0.0とボケ0.12.11、jupyter-クライアント5.1.0、jupyter-コンソール5.2.0、jupyterコア4.4.0
まだbokeh == 0.12.10の問題があります。多分、依存関係の変化がこれを破ったでしょうか?私が0.12.12を待ってそれをテストすることは意味をなさないかもしれません。 – Paul
私は言うことができません。私は '0.12.10'であなたのコードを実行し、期待通りに機能しました。 – bigreddot