Why display contour so slow in plotly dash?

Hi

I am showing a contour plot in plotly dash. From below, I have finished print(‘Done Updating the contour plot’) and return fig in callback function. But after that it takes really long time to show the contour plot? Any suggestion? Thanks

@app.callback(

    Output("padcontour-graph", "figure"),

    [Input("pad-radio-items", "value"), 

     Input("contour-range-slider-items", "value"),  # multiple input

     Input("dropdown-contour-key", "value")

    ],

)

def change_pad_contour(radio_value,range_slider_values,key):

    pad=radio_value

    contour_limit=range_slider_values

    print('limit_min=',contour_limit[0])

    fig=make_one_pad_contour(df_prod_trajectory_dict,key,area,pad,contour_limit,polys)  # 2nd figure is contour

    print('Done Updating the contour plot')

       

    return fig


def make_one_pad_contour(df_prod_trajectory_dict,key,area,pad,contour_limit,polys):
   
    fig = go.Figure()
    fig.add_trace(go.Scatter(x=x,y=y,mode='markers',marker=dict(color='black',size=3))                    
                     )  
        
    fig.add_trace(go.Contour(
                                z = Z.T, 
                                x = X[:,0], 
                                y = Y[0], 
                                colorscale='Turbo',  
                                contours=dict(
                                        start=z_min,
                                        end=z_max,
                                        size=25,
                                        coloring="heatmap"),
                                zmin=z_min,
                                zmax=z_max,
                                colorbar=dict(
                                        title=key.upper()+colorbar_unit_dict[key],
                                        titleside='right',
                                        titlefont=dict(
                                                size=20)
                                             )
        
                              )
                 )
        
    return fig