def cmatrix_plot_format(plot: Figure, format_cols: List, hover_code: str) -> Figure: plot.toolbar.logo = None plot.yaxis.axis_label_text_font_size = "16px" plot.yaxis.axis_label_text_color = '#003566' plot.xaxis.major_label_text_color = '#003566' plot.y_range.range_padding = 0 plot.hover.point_policy = "follow_mouse" plot.hover.attachment = "above" cust_formatters = {} for f in format_cols: code_ref = dashboard_constants.bucket_cust_format.format(field_name=f) if f == 'max_percentile_conf' else \ dashboard_constants.scale_format_code.format(field_name=f) cust_formatters[f] = CustomJSHover(args=dict(source=plot.renderers[0].data_source), code=code_ref) custom_hover_format = CustomJS(code=hover_code) format_dict = {f'@{c}': cust_formatters[c] for c in format_cols} plot.add_tools(HoverTool(tooltips=None, callback=custom_hover_format, formatters=format_dict)) someargs = dict(yaxis=plot.yaxis[0], xaxis=plot.xaxis[0], legend=plot.legend[0]) fig_resize_callback = CustomJS(args=someargs, code=dashboard_constants.fig_resize_callback_code) plot.js_on_change('inner_width', fig_resize_callback) return plot