# Buggy code
def update_frame(self, key, ranges=None, plot=None, element=None):
    """
    Updates an existing plot with data corresponding
    to the key.
    """
    reused = isinstance(self.hmap, DynamicMap) and (self.overlaid or self.batched)
    if not reused and element is None:
        element = self._get_frame(key)
    elif element is not None:
        self.current_key = key
        self.current_frame = element

    renderer = self.handles.get("glyph_renderer", None)
    glyph = self.handles.get("glyph", None)
    visible = element is not None
    if hasattr(renderer, "visible"):
        renderer.visible = visible
    if hasattr(glyph, "visible"):
        glyph.visible = visible

    if (
        (self.batched and not element)
        or element is None
        or (not self.dynamic and self.static)
        or (
            self.streaming
            and self.streaming[0].data is self.current_frame.data
            and not self.streaming[0]._triggering
        )
    ):
        return

    if self.batched:
        style_element = element.last
        max_cycles = None
    else:
        style_element = element
        max_cycles = len(self.style._options)
    style = self.lookup_options(style_element, "style")
    self.style = style.max_cycles(max_cycles) if max_cycles else style

    ranges = self.compute_ranges(self.hmap, key, ranges)
    self.set_param(**self.lookup_options(style_element, "plot").options)
    ranges = util.match_spec(style_element, ranges)
    self.current_ranges = ranges
    plot = self.handles["plot"]
    if not self.overlaid:
        self._update_ranges(style_element, ranges)
        self._update_plot(key, plot, style_element)

    self._update_glyphs(element, ranges)
    self._execute_hooks(element)


# Traceback (ZeroDivisionError)
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
/local_data/anaconda3/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)
330                 pass
331             else:
--> 332                 return printer(obj)
333             # Finally look for special method names
334             method = get_real_method(obj, self.print_method)

/local_data/anaconda3/lib/python3.6/site-packages/holoviews/ipython/display_hooks.py in pprint_display(obj)
257     if not ip.display_formatter.formatters['text/plain'].pprint:
258         return None
--> 259     return display(obj, raw=True)
260
261

/local_data/anaconda3/lib/python3.6/site-packages/holoviews/ipython/display_hooks.py in display(obj, raw, **kwargs)
237     elif isinstance(obj, (CompositeOverlay, ViewableElement)):
238         with option_state(obj):
--> 239             html = element_display(obj)
240     elif isinstance(obj, (Layout, NdLayout, AdjointLayout)):
241         with option_state(obj):

/local_data/anaconda3/lib/python3.6/site-packages/holoviews/ipython/display_hooks.py in wrapped(element)
129         try:
130             html = fn(element,
--> 131                       max_frames=OutputSettings.options['max_frames'])
132
133             # Only want to add to the archive for one display hook...

/local_data/anaconda3/lib/python3.6/site-packages/holoviews/ipython/display_hooks.py in element_display(element, max_frames)
176     if renderer.fig == 'pdf':
177         renderer = renderer.instance(fig='png')
--> 178     return renderer.html(element, fmt=renderer.fig)
179
180

/local_data/anaconda3/lib/python3.6/site-packages/holoviews/plotting/renderer.py in html(self, obj, fmt, css, comm, **kwargs)
253         code to initialize a Comm, if the plot supplies one.
254         """
--> 255         plot, fmt =  self._validate(obj, fmt)
256         figdata, _ = self(plot, fmt, **kwargs)
257         if css is None: css = self.css

/local_data/anaconda3/lib/python3.6/site-packages/holoviews/plotting/renderer.py in _validate(self, obj, fmt)
189         if isinstance(obj, tuple(self.widgets.values())):
190             return obj, 'html'
--> 191         plot = self.get_plot(obj, renderer=self)
192
193         fig_formats = self.mode_formats['fig'][self.mode]

/local_data/anaconda3/lib/python3.6/site-packages/holoviews/plotting/bokeh/renderer.py in get_plot(self_or_cls, obj, doc, renderer)
110         combining the bokeh model with another plot.
111         """
--> 112         plot = super(BokehRenderer, self_or_cls).get_plot(obj, renderer)
113         if self_or_cls.mode == 'server' and doc is None:
114             doc = curdoc()

/local_data/anaconda3/lib/python3.6/site-packages/holoviews/plotting/renderer.py in get_plot(self_or_cls, obj, renderer)
176             plot = self_or_cls.plotting_class(obj)(obj, renderer=renderer,
177                                                    **plot_opts)
--> 178             plot.update(0)
179         else:
180             plot = obj

/local_data/anaconda3/lib/python3.6/site-packages/holoviews/plotting/plot.py in update(self, key)
483     def update(self, key):
484         if len(self) == 1 and key == 0 and not self.drawn:
--> 485             return self.initialize_plot()
486         item = self.__getitem__(key)
487         self.traverse(lambda x: setattr(x, '_updated', True))

/local_data/anaconda3/lib/python3.6/site-packages/holoviews/plotting/bokeh/element.py in initialize_plot(self, ranges, plot, plots)
1414             frame = None
1415             if self.tabs: subplot.overlaid = False
-> 1416             child = subplot.initialize_plot(ranges, plot, plots)
1417             if isinstance(element, CompositeOverlay):
1418                 frame = element.get(key, None)

/local_data/anaconda3/lib/python3.6/site-packages/holoviews/plotting/bokeh/element.py in initialize_plot(self, ranges, plot, plots, source)
781         self.handles['plot'] = plot
782
--> 783         self._init_glyphs(plot, element, ranges, source)
784         if not self.overlaid:
785             self._update_plot(key, plot, style_element)

/local_data/anaconda3/lib/python3.6/site-packages/holoviews/plotting/bokeh/element.py in _init_glyphs(self, plot, element, ranges, source)
739         self.handles['source'] = source
740
--> 741         properties = self._glyph_properties(plot, style_element, source, ranges)
742         with abbreviated_exception():
743             renderer, glyph = self._init_glyph(plot, mapping, properties)

/local_data/anaconda3/lib/python3.6/site-packages/holoviews/plotting/bokeh/element.py in _glyph_properties(self, plot, element, source, ranges)
648
649     def _glyph_properties(self, plot, element, source, ranges):
--> 650         properties = self.style[self.cyclic_index]
651
652         if self.show_legend:

/local_data/anaconda3/lib/python3.6/site-packages/holoviews/core/options.py in __getitem__(self, index)
483         looping over the set of defined Cycle objects.
484         """
--> 485         return dict(self._options[index % len(self._options)])
486
487

ZeroDivisionError: integer division or modulo by zero

:Overlay
.Dataset_Group.Ds1 :Curve   [y]   (x)
.Dataset_Group.Ds2 :Curve   [y]   (x)
.Dataset_Group.Ds3 :Curve   [y]   (x)

# Fixed code
def update_frame(self, key, ranges=None, plot=None, element=None):
    """
    Updates an existing plot with data corresponding
    to the key.
    """
    reused = isinstance(self.hmap, DynamicMap) and (self.overlaid or self.batched)
    if not reused and element is None:
        element = self._get_frame(key)
    elif element is not None:
        self.current_key = key
        self.current_frame = element

    renderer = self.handles.get("glyph_renderer", None)
    glyph = self.handles.get("glyph", None)
    visible = element is not None
    if hasattr(renderer, "visible"):
        renderer.visible = visible
    if hasattr(glyph, "visible"):
        glyph.visible = visible

    if (
        (self.batched and not element)
        or element is None
        or (not self.dynamic and self.static)
        or (
            self.streaming
            and self.streaming[0].data is self.current_frame.data
            and not self.streaming[0]._triggering
        )
    ):
        return

    if self.batched:
        style_element = element.last
        max_cycles = None
    else:
        style_element = element
        max_cycles = self.style._max_cycles
    style = self.lookup_options(style_element, "style")
    self.style = style.max_cycles(max_cycles) if max_cycles else style

    ranges = self.compute_ranges(self.hmap, key, ranges)
    self.set_param(**self.lookup_options(style_element, "plot").options)
    ranges = util.match_spec(style_element, ranges)
    self.current_ranges = ranges
    plot = self.handles["plot"]
    if not self.overlaid:
        self._update_ranges(style_element, ranges)
        self._update_plot(key, plot, style_element)

    self._update_glyphs(element, ranges)
    self._execute_hooks(element)