I generated two scatter plots in the same chart using Python and Bokeh, and added checkboxes to allow separate viewing of scatter plot.
How can I add regression lines for the two scatter plots (with equations) using Bokeh?
output_file("Scatterplot.html")
#scatter plot
S0 = f.circle(A_area, A_price,
fill_alpha=0.3, size=3, color='green')
S1 = f.circle(B_area, B_price,
fill_alpha=0.3, size=3, color='blue')
#widget-checkbox
checkboxes = CheckboxGroup(labels=["A", "B"], active=[0, 1])
callback = CustomJS(code="""S0.visible = false; // same S0 passed in from args
S1.visible = false;
// cb_obj injected in by the callback
if (cb_obj.active.includes(0)){S0.visible = true;} // 0 index box is S0
if (cb_obj.active.includes(1)){S1.visible = true;}""",
args={'S0': S0, 'S1': S1})
checkboxes.js_on_click(callback)