Bokeh Call Back to update Hover tool

Dear All
I have developed a small app.
It has scatter plot which update from a select .

Issue is Hover tool is not shown when i plot inside the call back .

it displays hover tool only if scatter plot is rendered outside call back

here is the code

source=ColumnDataSource(df_new)
hover=HoverTool(
tooltips=[
( ‘date’, ‘@bh_date{%F}’ ),
( ‘cell’, ‘@cell_name_new’ ), # use @{ } for field names with spaces
( ‘user’, ‘@avg_user_number{0.0 a}’ ),
( ‘thpt’, ‘@dl_user_thpt_mbps{0.0 a}’ ),
( ‘prb’, ‘@dlprb_util{0.0 a}’ ),
( ‘cqi’, ‘@cqi_2016_avg{0.0 a}’ ),
],

    formatters={
        'bh_date'      : 'datetime', # use 'datetime' formatter for 'date' field
#         'adj close' : 'printf',   # use 'printf' formatter for 'adj close' field
                                  # use default 'numeral' formatter for other fields
    },

    # display a tooltip whenever the cursor is vertically in line with a glyph
    mode='vline'
)

tools = [hover, BoxZoomTool(), ResetTool(), CrosshairTool(), BoxSelectTool(), WheelZoomTool()]
p1 = figure(x_axis_type=“datetime”, title=‘Users’, width = 600, height = 450,tools=tools,sizing_mode=“stretch_width”)
p1.scatter(x=‘bh_date’,y=‘avg_user_number’,source=source,legend_field=‘cell_name_new’,line_color=cell_cmp,fill_color=cell_cmp)

it works .

but when i bring p1.scatter inside call back ,plot updated fine but no display of hover tool

def update_plot(attr,old,new):
source.data=df_new
p1.scatter(x=‘bh_date’,y=‘avg_user_number’,source=source,legend_field=‘cell_name_new’,line_color=cell_cmp,fill_color=cell_cmp)

i need help how to update hover tool from call back

i am successfully updating dataframe from call back

You don’t need to call p1.scatter again, just change the data source.

@shakeel gentle request: please always format code blocks using the </> button in the GUI editor, or using triple backtick ``` fences

Hi

If I only change the data source .it load all data into the plot .which makes the page very slow .

To avoid this I only call p1.scatter to load of there is change from select .

Challenge is to call hover only ,when there is change on select widget .

It’s going to do this regardless. Calling p1.scatter in the callback is not only not a good idea, it is definitely more work than just updating the data.