# Slider callback plot does not update

**URL:** <https://discourse.bokeh.org/t/slider-callback-plot-does-not-update/6024>\
**Category:** Community Support\
**Created:** [July 22, 2020, 3:10am UTC](https://discourse.bokeh.org/t/slider-callback-plot-does-not-update/6024 "2020-07-22T03:10:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![scheine](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/s/50afbb/32.png) [@scheine](https://discourse.bokeh.org/u/scheine)\
**Post date:** [July 22, 2020, 3:10am UTC](https://discourse.bokeh.org/t/slider-callback-plot-does-not-update/6024/1 "2020-07-22T03:10:47Z")

</div>

```
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)
```

---

<div class="post-metadata">

**Author:** ![Bryan](https://discourse.bokeh.org/user_avatar/discourse.bokeh.org/bryan/32/3625_2.png) [@Bryan](https://discourse.bokeh.org/u/Bryan)\
**Post date:** [July 22, 2020, 4:10am UTC](https://discourse.bokeh.org/t/slider-callback-plot-does-not-update/6024/2 "2020-07-22T04:10:45Z")

</div>

Hi @scheine please edit your post to use code formatting so that the code is intelligible (either with the `</>` icon on the editing toolbar, or triple backtick ``` fences around the code blocks)

---

<div class="post-metadata">

**Author:** ![scheine](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/s/50afbb/32.png) [@scheine](https://discourse.bokeh.org/u/scheine)\
**Post date:** [July 22, 2020, 11:15am UTC](https://discourse.bokeh.org/t/slider-callback-plot-does-not-update/6024/3 "2020-07-22T11:15:26Z")

</div>

I have removed comment lines, now it is good.

---

<div class="post-metadata">

**Author:** ![\_jm](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/_/ac91a4/32.png) [@\_jm](https://discourse.bokeh.org/u/_jm)\
**Post date:** [July 22, 2020, 11:50am UTC](https://discourse.bokeh.org/t/slider-callback-plot-does-not-update/6024/4 "2020-07-22T11:50:52Z")

</div>

@scheine

Your code is using python callbacks with the bokeh standalone application `show()` command. These are incompatible; python callbacks require you to use bokeh server. See [Running a bokeh server](https://docs.bokeh.org/en/latest/docs/user_guide/server.html).

If you don’t want to use a bokeh server, you need to refactor your code to use JavaScript callbacks.

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads.bokeh.org/original/2X/1/14eb24f9e10e4e9b78e3f10f66c04ffa96446e5a.svg) [@system](https://discourse.bokeh.org/u/system)\
**Post date:** [July 21, 2021, 9:27pm UTC](https://discourse.bokeh.org/t/slider-callback-plot-does-not-update/6024/5 "2021-07-21T21:27:15Z")

</div>


