Hi, i’m new here. I made a course about interactive data visualization on Datacamp. I want it to reproduce the exercises on jupyter notebook. The problem is, the graph doesn’t change when i change the Slider and got the next error:
WARNING:bokeh.embed.util:
You are generating standalone HTML/JS output, but trying to use real Python
callbacks (i.e. with on_change or on_event). This combination cannot work.Only JavaScript callbacks may be used with standalone output. For more
information on JavaScript callbacks with Bokeh, see:https://docs.bokeh.org/en/latest/docs/user_guide/interaction/callbacks.html
Alternatively, to use real Python callbacks, a Bokeh server application may
be used. For more information on building and running Bokeh applications, see:https://docs.bokeh.org/en/latest/docs/user_guide/server.html
My code is:
from bokeh.io import output_notebook, push_notebook, show
output_notebook()
def update_plot(attr, old, new):
yr = slider.value
new_data = {
'x' : data.loc[yr].fertility,
'y' : data.loc[yr].life,
'country' : data.loc[yr].Country,
'pop' : (data.loc[yr].population / 20000000) + 2,
'region' : data.loc[yr].region,
}
source.data = new_data
plot.title.text = 'Gapminder data for %d' % yr
slider = Slider(start= 1964, end= 2013, step= 1, value= 1964, title= 'Year')
slider.on_change('value', update_plot)
layout = row(Column(slider), plot )
curdoc().add_root(layout)
output_file('gapminder4.html')
show(layout, notebook_handle= True)
Maybe I is something to do with the server but I look for information in the bokeh website and i’m really confused