I have a bokeh figure in a Jupyter notebook with a circle glyph, using a data source of a pandas dataframe. I would like to be able to update the x values of the glyph to a different column in that data frame and have the original figure update in the notebook.
This is how my original figure is created:
p=figure()
source = ColumnDataSource(df)
p.circle(‘AVG_SPEED1’,‘y_value’, size=‘scale_unit’, source=source)
t = show(p, notebook_handle=True)
Then I want to be able to update that in the next notebook cell, to use another similar set of values in that dataframe with a column name of ‘AVG_SPEED2’, and have the chart update with push_notebook.
gr = p.select(dict(type=GlyphRenderer))
gr[0].glyph.x = ‘AVG_SPEED2’
push_notebook(handle=t)
How do I trigger that glyph to read that new column from the already attached data_source and re-render? Would I be better off just removing the glyph and adding it again?
Thanks in advance!
Victor