Hi. I’m new to Bokeh and would like to learn how to create a plot with a slider that’s deployed using the Bokeh server. I found three examples of code on the internet and managed to get the scripts to open in browser windows using the Anaconda Command Prompt and Bokeh Serve command. Unfortunately though, for all three code examples, the number of glyphs in the plots do not change when I move the slider value. Everything else looks fine, except the plots do not update when I move the slider. I have the latest version of Bokeh installed and tried using several different internet browsers. I’m sure it is an easy fix, but just not sure where to start. One of the codes (from DataCamp) that I tried without success is below. Any help would be appreciated. Thank you.
from bokeh.io import curdoc
from bokeh.layouts import column
from bokeh.models import ColumnDataSource, Slider
from bokeh.plotting import figure
from numpy.random import random
N = 300
source = ColumnDataSource(data={'x': random(N), 'y': random(N)})
# Create plots and widgets
plot = figure()
plot.circle(x= 'x', y='y', source=source)
slider = Slider(start=100, end=1000, value=N, step=10, title='Number of points')
# Add callback to widgets def callback(attr, old, new):
def callback(attr, old, new):
N = slider.value
source.data={'x': random(N), 'y': random(N)}
slider.on_change('value', callback)
# Arrange plots and widgets in layouts
layout = column(slider, plot)
curdoc().add_root(layout)