code: def update(attr, old, new):
      inds = new
      if len(inds) == 0 or len(inds) == len(x):
          hhist1, hhist2 = hzeros, hzeros
          vhist1, vhist2 = vzeros, vzeros
      else:
          neg_inds = np.ones_like(x, dtype=np.bool)
          neg_inds[inds] = False
          hhist1, _ = np.histogram(x[inds], bins=hedges)
          vhist1, _ = np.histogram(y[inds], bins=vedges)
          hhist2, _ = np.histogram(x[neg_inds], bins=hedges)
          vhist2, _ = np.histogram(y[neg_inds], bins=vedges)
  
      hh1.data_source.data["top"] = hhist1
      hh2.data_source.data["top"] = -hhist2
      vh1.data_source.data["right"] = vhist1
      vh2.data_source.data["right"] = -vhist2
  
imports: import numpy
  from bokeh.layouts import gridplot
  from bokeh.models import BoxSelectTool, LassoSelectTool
  from bokeh.plotting import curdoc, figure
label_desc: Use image node_id 1 for calling a global function with example usage: update(attr, old, new) without return types