@@ -590,7 +590,7 @@ def plot(self, *, scatter_or_line="scatter"):
590590
591591 Returns
592592 -------
593- plot : `holoviews.Scatter`, `holoviews.Path`, or `holoviews. Overlay`
593+ plot : `holoviews.Overlay`
594594 Plot of the evaluated data.
595595 """
596596 if scatter_or_line not in ("scatter" , "line" ):
@@ -600,13 +600,15 @@ def plot(self, *, scatter_or_line="scatter"):
600600 xs , ys = zip (* sorted (self .data .items ())) if self .data else ([], [])
601601 if scatter_or_line == "scatter" :
602602 if self .vdim == 1 :
603- p = hv .Scatter ((xs , ys ))
603+ plots = [ hv .Scatter ((xs , ys ))]
604604 else :
605- scatters = [hv .Scatter ((xs , _ys )) for _ys in np .transpose (ys )]
606- p = hv .Overlay (scatters )
605+ plots = [hv .Scatter ((xs , _ys )) for _ys in np .transpose (ys )]
607606 else :
608- p = hv .Path ((xs , ys ))
607+ plots = [ hv .Path ((xs , ys ))]
609608
609+ # Put all plots in an Overlay because a DynamicMap can't handle changing
610+ # datatypes, e.g. when `vdim` isn't yet known and the live_plot is running.
611+ p = hv .Overlay (plots )
610612 # Plot with 5% empty margins such that the boundary points are visible
611613 margin = 0.05 * (self .bounds [1 ] - self .bounds [0 ])
612614 plot_bounds = (self .bounds [0 ] - margin , self .bounds [1 ] + margin )
0 commit comments