Hello! I’m having quite a bit of trouble doing something (that should be) very simple in Bokeh. My goal is to animate the movement of a circle on a set of axes. The circles X / Y data is precalculated and stored in a dataframe. My approach, pasted below, is to use an ipython widget. Unfortunately, the code doesn’t update!
I’ve pasted an example of what I’m trying to do below. Note that I’m using a parametric equation below, but only for convenience. In my final code, the data must be precalculated, and indexed into within update().
Thanks!
- gD
import numpy as np
from bokeh.io import push_notebook
import bokeh.plotting as bkP
import bokeh.models as bkM
from ipywidgets import interact
import numpy as np
bkP.output_notebook()
xs = np.linspace(0, 2*np.pi, 2000)
ys = np.sin(xs)
frame = 0
x = xs[frame]
y = np.sin(x)
p = bkP.figure(plot_width=300,plot_height=300)
frame = 0
theCircle = p.circle(,
[y],
name = ‘circle’,size=10)
bkP.show(p)
def update(frame=0):
theCircle.data_source.data[‘x’] = [xs[frame]]
theCircle.data_source.data[‘y’] = [ys[frame]]
push_notebook()
bkP.show(p) # this seems suspect
interact(update, frame=(0,len(xs),1))
``

