Bokeh Plots Not Updating using Select functionality

Hello,

I am trying to update plots and doing callback via Select tool. However, the plot is not updating and sticks with the default value. Is this something with Jupyter notebook or not really?

Thank you!

Hi,

Without actual code to look at or try out, it's difficult to say anything concrete. Perhaps you can share a notebook?

Thanks,

Bryan

···

On Dec 27, 2016, at 3:46 PM, [email protected] wrote:

Hello,

I am trying to update plots and doing callback via Select tool. However, the plot is not updating and sticks with the default value. Is this something with Jupyter notebook or not really?

Thank you!

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/ffc07f8d-e708-476d-9fb7-95556419301f%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi Bryan,

Below is the code: Would this help?

Thanks!

Importing some of the BOKEH functions:

from bokeh.io import curdoc, output_file, show, push_notebook

from bokeh.layouts import column,row

from bokeh.models import HoverTool, Select, ColumnDataSource

from bokeh.plotting import figure, reset_output, ColumnDataSource

from bokeh.models.widgets import Panel, Tabs, DataTable, DateFormatter, TableColumn

from numpy.random import random, normal, lognormal

CAH_cds = ColumnDataSource(CAH[CAH.Month == 10])

def update_plot(attr, old, new):

mon_val = menu.value

CAH_cds.data[‘Dt’] = list(CAH.Dt[CAH.Month == int(mon_val)])

CAH_cds.data[‘Census’] = list(CAH.Census[CAH.Month == int(mon_val)])

CAH_cds.data[‘CountAtStart’] = list(CAH.CountAtStart[CAH.Month == int(mon_val)])

push_notebook()

CAHplot.line(x=‘Dt’, y=‘Census’, source=CAH_cds, line_dash=[4, 4], color=‘purple’, alpha = 0.8, line_width=2, legend=‘Predicted’)

CAHplot.line(x=‘Dt’, y=‘CountAtStart’, source=CAH_cds, color=‘blue’, alpha = 0.3, line_width=2, legend=‘Actual’)

CAHplot.title.text = “CAH.0401.40505 = 3NE.CH”

menu = Select(options=[‘9’,‘10’], value=‘10’, title=‘Select Month’)

menu.on_change(‘value’, update_plot)

tab1 = Panel(child = l1, title=‘Carney’)

layout = Tabs(tabs = [tab1,tab2,tab3,tab4])

···

On Tuesday, 27 December 2016 16:49:26 UTC-5, Bryan Van de ven wrote:

Hi,

Without actual code to look at or try out, it’s difficult to say anything concrete. Perhaps you can share a notebook?

Thanks,

Bryan

On Dec 27, 2016, at 3:46 PM, [email protected] wrote:

Hello,

I am trying to update plots and doing callback via Select tool. However, the plot is not updating and sticks with the default value. Is this something with Jupyter notebook or not really?

Thank you!


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/ffc07f8d-e708-476d-9fb7-95556419301f%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hello Bryan,

Actually, I just learned that user interactions only work if we run it on bokeh server. That actually helped and it was able to pick up the data and update it.

Thanks!

···

On Tuesday, 27 December 2016 16:58:33 UTC-5, [email protected] wrote:

Hi Bryan,

Below is the code: Would this help?

Thanks!

Importing some of the BOKEH functions:

from bokeh.io import curdoc, output_file, show, push_notebook

from bokeh.layouts import column,row

from bokeh.models import HoverTool, Select, ColumnDataSource

from bokeh.plotting import figure, reset_output, ColumnDataSource

from bokeh.models.widgets import Panel, Tabs, DataTable, DateFormatter, TableColumn

from numpy.random import random, normal, lognormal

CAH_cds = ColumnDataSource(CAH[CAH.Month == 10])

def update_plot(attr, old, new):

mon_val = menu.value

CAH_cds.data[‘Dt’] = list(CAH.Dt[CAH.Month == int(mon_val)])

CAH_cds.data[‘Census’] = list(CAH.Census[CAH.Month == int(mon_val)])

CAH_cds.data[‘CountAtStart’] = list(CAH.CountAtStart[CAH.Month == int(mon_val)])

push_notebook()

CAHplot.line(x=‘Dt’, y=‘Census’, source=CAH_cds, line_dash=[4, 4], color=‘purple’, alpha = 0.8, line_width=2, legend=‘Predicted’)

CAHplot.line(x=‘Dt’, y=‘CountAtStart’, source=CAH_cds, color=‘blue’, alpha = 0.3, line_width=2, legend=‘Actual’)

CAHplot.title.text = “CAH.0401.40505 = 3NE.CH

menu = Select(options=[‘9’,‘10’], value=‘10’, title=‘Select Month’)

menu.on_change(‘value’, update_plot)

tab1 = Panel(child = l1, title=‘Carney’)

layout = Tabs(tabs = [tab1,tab2,tab3,tab4])

On Tuesday, 27 December 2016 16:49:26 UTC-5, Bryan Van de ven wrote:

Hi,

Without actual code to look at or try out, it’s difficult to say anything concrete. Perhaps you can share a notebook?

Thanks,

Bryan

On Dec 27, 2016, at 3:46 PM, [email protected] wrote:

Hello,

I am trying to update plots and doing callback via Select tool. However, the plot is not updating and sticks with the default value. Is this something with Jupyter notebook or not really?

Thank you!


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/ffc07f8d-e708-476d-9fb7-95556419301f%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.