@@ -590,7 +590,7 @@ def plot(self, *, scatter_or_line="scatter"):
590
590
591
591
Returns
592
592
-------
593
- plot : `holoviews.Scatter`, `holoviews.Path`, or `holoviews. Overlay`
593
+ plot : `holoviews.Overlay`
594
594
Plot of the evaluated data.
595
595
"""
596
596
if scatter_or_line not in ("scatter" , "line" ):
@@ -600,13 +600,15 @@ def plot(self, *, scatter_or_line="scatter"):
600
600
xs , ys = zip (* sorted (self .data .items ())) if self .data else ([], [])
601
601
if scatter_or_line == "scatter" :
602
602
if self .vdim == 1 :
603
- p = hv .Scatter ((xs , ys ))
603
+ plots = [ hv .Scatter ((xs , ys ))]
604
604
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 )]
607
606
else :
608
- p = hv .Path ((xs , ys ))
607
+ plots = [ hv .Path ((xs , ys ))]
609
608
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 )
610
612
# Plot with 5% empty margins such that the boundary points are visible
611
613
margin = 0.05 * (self .bounds [1 ] - self .bounds [0 ])
612
614
plot_bounds = (self .bounds [0 ] - margin , self .bounds [1 ] + margin )
0 commit comments