Arrow data does not update

Hello,
I’ve come across a strange behavior when updating arrow data with new Bokeh.

These two snippets are equivalent, right?

#1 Updating data by replacing everything:
cds_arrow.data = dict(xS=[0], yS=[1], xE=[new], yE=[1])

#2 Updating data by using stream:
cds_arrow.stream(dict(xS=[0], yS=[1], xE=[new], yE=[1]),rollover=1)

However, when using #1, the plot does not update the arrow glyph.

Minimal Example
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, Slider, Arrow, OpenHead
from bokeh.layouts import column
from bokeh.io import curdoc

cds_arrow = ColumnDataSource(dict(xS=[0], yS=[1], xE=[1], yE=[1]))
cds_line  = ColumnDataSource(dict(x=[0,1], y=[3,3]))

def slider_callback_data(attr,old,new):
    cds_arrow.data = dict(xS=[0], yS=[1], xE=[new], yE=[1])
    cds_line.data  = dict(x=[0,new], y=[3,3])
    #print(cds_arrow.data) # data is updated but not plotted

def slider_callback_stream(attr,old,new):
    cds_arrow.stream(dict(xS=[0], yS=[1], xE=[new], yE=[1]),rollover=1)
    cds_line.stream(dict(x=[0,new], y=[3,3]),rollover=2)


slider_data = Slider(title="cds.data", value=1.0, start=0.0, end=5.0, step=0.1, width=400)
slider_data.on_change('value',slider_callback_data)

slider_stream = Slider(title="cds.stream", value=1.0, start=0.0, end=5.0, step=0.1, width=400)
slider_stream.on_change('value',slider_callback_stream)

figure_test = figure(title="Example Figure", x_range=(-1,6), y_range=(-0.5,4.5), height=300, width=400, tools="")
figure_test.line(x='x', y='y', source=cds_line)
arrow_glyph = Arrow(end=OpenHead(), x_start='xS', y_start='yS', x_end='xE', y_end='yE',source=cds_arrow)
figure_test.add_layout(arrow_glyph)


curdoc().add_root(column(figure_test, slider_data, slider_stream))


It definitely worked back in Bokeh 1.0.2 and e.g. for lines it still works in the new Bokeh as you can see in the above minimal example.

Is this a bug or was something changed regarding the Arrow model? I could not find a possible change in the Changelog.

They should be, but the best thing in a case like this is a complete, minimal reproducer that can be run and investigated. (I.e. it’s entirely possible there is something else going on either usage problem or bug and this is only a secondary symptom, without code to run it is impossible to speculate).

The code is already there, just hidden in the “Minimal Example” spoiler :stuck_out_tongue:

Should be run in main.py file using bokeh serve though.

Huh, didn’t know that feature existed. In any case it looks like this was reported as a regression in a comment awhile back:

https://github.com/bokeh/bokeh/issues/7118#issuecomment-533359729

At the time I asked for a new issue so that we could properly track this, and the person said they would make one, but evidently never did. (So it got forgotten) Please make a new GH issue with the reproducer so we can prioritize fixing.

1 Like

Ok, I opened a new issue here https://github.com/bokeh/bokeh/issues/9436

1 Like

There seems to be some related bug (see #9522).
Even when using .stream method, the arrows do not render fully in a plot, depending on the page layout.