Developed a server app where the ticks property of a FixedTicker object was meant to be updated in a callback. This produced an unexpected ValueError. Found that just creating a new FixedTicker object each time the callback is executed works, but that does not seem to be best coding practice for bokeh! Here is a minimal example. As-is it works on the first iteration only (loading the app). When Button is pressed a ValueError triggers when the ticks property is updated. Otherwise the minimal example can be made to work by creating a new FixedTicker object at each iteration (uncomment line 16, comment line 15). Not sure if this a bug or feature…
import numpy as np
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, FixedTicker, Button
from bokeh.layouts import row
from bokeh.io import curdoc
src = ColumnDataSource()
fig = figure(width=600, height=200)
fig.xaxis.ticker = FixedTicker()
fig.circle('x', 'y', source=src)
def update():
n = np.random.choice(range(2, 20))
src.data = {'x': np.arange(n), 'y': np.arange(n) ** 2}
fig.xaxis.ticker.ticks = np.arange(n) # update existing FixedTicker
# fig.xaxis.ticker = FixedTicker(ticks=np.arange(n)) # create new FixedTicker
button = Button()
button.on_click(update)
update()
curdoc().add_root(row(button, fig))