class_docstr: Plotting baseclass for the Bokeh backends, implementing the basic
  plotting interface for Bokeh based plots.
class_docstr_tok: ["Plotting","baseclass","for","the","Bokeh","backends",",","implementing","the","basic","plotting","interface","for","Bokeh","based","plots","."]
docstr: Cleans up references to the plot after the plot has been
  deleted. Traverses through all plots cleaning up Callbacks and
  Stream subscribers.
code: def cleanup(self):
      """
      Cleans up references to the plot after the plot has been
      deleted. Traverses through all plots cleaning up Callbacks and
      Stream subscribers.
      """
      plots = self.traverse(lambda x: x, [BokehPlot])
      for plot in plots:
          if not isinstance(
              plot,
              (
                  GenericCompositePlot,
                  GenericElementPlot,
                  GenericOverlayPlot,
              ),
          ):
              continue
          streams = list(plot.streams)
          plot.streams = []
          plot._document = None
  
          if plot.subplots:
              plot.subplots.clear()
  
          if isinstance(plot, GenericElementPlot):
              for callback in plot.callbacks:
                  streams += callback.streams
                  callback.cleanup()
  
          for stream in set(streams):
              stream._subscribers = [
                  (p, subscriber)
                  for p, subscriber in stream._subscribers
                  if not is_param_method(subscriber)
                  or get_method_owner(subscriber) not in plots
              ]
  
imports: from collections import defaultdict
  from itertools import groupby
  import numpy
  import param
  from bokeh.layouts import gridplot
  from bokeh.models import Axis, ColorBar, Column, ColumnDataSource, Div, Legend, Row, Title
  from bokeh.models.layouts import TabPanel, Tabs
  from ...core import AdjointLayout, Element, Empty, GridSpace, HoloMap, Layout, NdLayout, Store
  from ...core.options import SkipRendering
  from ...core.util import _STANDARD_CALENDARS, cftime_to_timestamp, cftime_types, get_method_owner, is_param_method, unique_iterator, wrap_tuple, wrap_tuple_streams
  from ...selection import NoOpSelectionDisplay
  from ..links import Link
  from ..plot import CallbackPlot, DimensionedPlot, GenericAdjointLayoutPlot, GenericCompositePlot, GenericElementPlot, GenericLayoutPlot, GenericOverlayPlot
  from ..util import attach_streams, collate, displayable
  from .links import LinkCallback
  from .util import cds_column_replace, decode_bytes, empty_plot, filter_toolboxes, get_default, make_axis, merge_tools, select_legends, sync_legends, theme_attr_json, update_shared_sources
label_desc: Use image node_id 10 for calling the BokehPlot obj's underlying member method code with example usage: obj.cleanup() without return types