Skip to content Skip to sidebar Skip to footer

Why Is Bokeh's Plot Not Changing With Plot Selection?

Struggling to understand why this bokeh visual will not allow me to change plots and see the predicted data. The plot and select (dropdown-looking) menu appears, but I'm not able t

Solution 1:

Your update_plot is a no-op that does not actually make any changes to Bokeh model state, which is what is necessary to change a Bokeh plot. Changing Bokeh model state means assigning a new value to a property on a Bokeh object. Typically, to update a plot, you would compute a new data dict and then set an existing CDS from it:

source.data = new_data  # plain python dict

Or, if you want to update from a DataFame:

source.data = ColumnDataSource.from_df(new_df)

As an aside, don't assign the .data from one CDS to another:

source.data = other_source.data  # BAD

By contrast, your update_plot computes some new data and then throws it away. Note there is never any purpose to returning anything at all from any Bokeh callback. The callbacks are called by Bokeh library code, which does not expect or use any return values.

Lastly, I don't think any of those last JS console errors were generated by BokehJS.

Post a Comment for "Why Is Bokeh's Plot Not Changing With Plot Selection?"