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().
The first note is that you don't need (and should not have) the "show" call in the "update function". In general it defeats the purpose of the efficient notebook comms, but there is also a current bug (to be fixed in 0.11.1) where only the last shown plot gets updated (so showing a second time will bump into that issue).
But also, Bokeh's "show" and Jupyter's "interact" both use the notebook cell publishing machinery to display themselves. Putting both in one cell means that one's output will "overwrite" the other's. So, they need to go in different cells. I am not aware of any way around this, unfortunately. When I split up your example in to a few cells, and delete the extra "show" in the callback, then it works great.
Thanks,
Bryan
···
On Jan 15, 2016, at 4:49 PM, Gabriel Diaz <[email protected]> wrote:
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
Indeed, it works like a charm, now. Thanks, Bryan!
···
On Friday, January 15, 2016 at 5:49:53 PM UTC-5, Gabriel Diaz wrote:
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().