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: Update datasource with data for a new frame.
code: def _update_datasource(self, source, data):
      """
      Update datasource with data for a new frame.
      """
      if not self.document:
          return
  
      data = self._postprocess_data(data)
      empty = all(len(v) == 0 for v in data.values())
      if (
          self.streaming
          and self.streaming[0].data is self.current_frame.data
          and self._stream_data
          and not empty
      ):
          stream = self.streaming[0]
          if stream._triggering:
              data = {
                  k: v[-stream._chunk_length :] for k, v in data.items()
              }
              source.stream(data, stream.length)
          return
  
      if cds_column_replace(source, data):
          source.data = data
      else:
          source.data.update(data)
  
      if hasattr(self, "selected") and self.selected is not None:
          self._update_selected(source)
  
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 6 for calling the BokehPlot obj's underlying member method code with example usage: obj._update_datasource(source, data) without return types