☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Slider callback plot does not update

Community Support
scheine
scheine
def make_cds(a, b):

    df_summ = df.loc[(df['A'] > a) & (df['B'] < b)]

    return df_summ


def make_plot(df_summ):

    new_src = ColumnDataSource(df_summ)

    exp_cmap = LinearColorMapper(palette="Viridis256", 
                         low = min(df_summ["C"]), 
                         high = max(df_summ["C"]))

    p = figure(plot_width = 300, plot_height = 300)
    p1 = p.circle('D', 'E', source=new_src, line_color=None, size=15,
            fill_color={'field':'C', 'transform':exp_cmap})


    return p


A_slider = Slider(start = 0.03, end = 0.12, 
                     step = 0.005, value = 0.07,
                     title = 'A')
B_slider = Slider(start = 560, end = 760, value = 660,
                           step = 10, title = 'B')


def slider_callback(attr, old, new):
    a = A_slider.value
    b = B_slider.value
    df_summ = df.loc[(df['A'] > a) & (df['B'] < b)]

    new_src = ColumnDataSource(df_summ)

    source.data = new_src.data


A_slider.on_change('value', slider_callback)
B_slider.on_change('value', slider_callback)  


a = 0.07
b = 660

df_summ = make_cds(a, b)
p = make_plot(df_summ)



layout = column(A_slider, B_slider, p)
show(layout)
⌁   Link to post

End of archived discussion · Replies are disabled