-
-
Notifications
You must be signed in to change notification settings - Fork 99
/
__init__.py
61 lines (44 loc) · 1.76 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import holoviews as hv
from ..util import with_hv_extension, is_polars
from .core import hvPlot, hvPlotTabular # noqa
from .andrews_curves import andrews_curves # noqa
from .parallel_coordinates import parallel_coordinates # noqa
from .lag_plot import lag_plot # noqa
from .scatter_matrix import scatter_matrix # noqa
@with_hv_extension
def plot(data, kind, **kwargs):
# drop reuse_plot
kwargs.pop('reuse_plot', None)
# replace with shared_axes
sharex = kwargs.pop('sharex', None)
sharey = kwargs.pop('sharey', None)
if sharex is not None and sharey is not None:
kwargs['shared_axes'] = sharex or sharey
elif sharex is not None:
kwargs['shared_axes'] = sharex
elif sharey is not None:
kwargs['shared_axes'] = sharey
# drop all kwargs that are set to None
no_none_kwargs = {}
for k, v in kwargs.items():
if v is not None:
no_none_kwargs[k] = v
if is_polars(data):
from hvplot.polars import hvPlotTabularPolars
return hvPlotTabularPolars(data)(kind=kind, **no_none_kwargs)
return hvPlotTabular(data)(kind=kind, **no_none_kwargs)
def boxplot_series(*args, **kwargs):
return plot(*args, kind='box', **kwargs)
def boxplot_frame(*args, **kwargs):
return plot(*args, kind='box', **kwargs)
def boxplot_frame_groupby(grouped, **kwargs):
width = kwargs.pop('width', 300)
subplots = kwargs.pop('subplots', True)
layout = hv.Layout if subplots else hv.Overlay
plots = [plot(data=data, kind='box', title=name, width=width, **kwargs)
for name, data in grouped]
return layout(plots)
def hist_series(*args, **kwargs):
return plot(*args, kind='hist', **kwargs)
def hist_frame(*args, **kwargs):
return plot(*args, kind='hist', **kwargs)