@@ -580,22 +580,33 @@ def _loss(self, mapping, ival):
580
580
loss = mapping [ival ]
581
581
return finite_loss (ival , loss , self ._scale [0 ])
582
582
583
- def plot (self ):
583
+ def plot (self , * , scatter_or_line = None ):
584
584
"""Returns a plot of the evaluated data.
585
585
586
586
Returns
587
587
-------
588
588
plot : `holoviews.element.Scatter` (if vdim=1)\
589
589
else `holoviews.element.Path`
590
590
Plot of the evaluated data.
591
+ scatter_or_line : str, optional
592
+ Plot as a scatter plot ("scatter") or a line plot ("line").
593
+ By default a line plot will be chosen if the data consists of
594
+ vectors, otherwise it is a scatter plot.
591
595
"""
592
596
hv = ensure_holoviews ()
593
597
594
598
xs , ys = zip (* sorted (self .data .items ())) if self .data else ([], [])
595
599
if self .vdim == 1 :
596
- p = hv .Path ([]) * hv .Scatter ((xs , ys ))
600
+ if scatter_or_line is None or scatter_or_line == "scatter" :
601
+ p = hv .Path ([]) * hv .Scatter ((xs , ys ))
602
+ else :
603
+ p = hv .Path ((xs , ys )) * hv .Scatter ()
597
604
else :
598
- p = hv .Path ((xs , ys )) * hv .Scatter ([])
605
+ if scatter_or_line is None or scatter_or_line == "line" :
606
+ p = hv .Path ((xs , ys )) * hv .Scatter ([])
607
+ else :
608
+ scatters = [hv .Scatter ((xs , _ys )) for _ys in np .transpose (ys )]
609
+ p = hv .Path ([]) * hv .Overlay (scatters )
599
610
600
611
# Plot with 5% empty margins such that the boundary points are visible
601
612
margin = 0.05 * (self .bounds [1 ] - self .bounds [0 ])
0 commit comments