hvplot 0.9.3a1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. hvplot/__init__.py +322 -0
  2. hvplot/_version.py +16 -0
  3. hvplot/backend_transforms.py +329 -0
  4. hvplot/converter.py +2855 -0
  5. hvplot/cudf.py +26 -0
  6. hvplot/dask.py +42 -0
  7. hvplot/data/crime.csv +56 -0
  8. hvplot/datasets.yaml +48 -0
  9. hvplot/fugue.py +64 -0
  10. hvplot/ibis.py +21 -0
  11. hvplot/intake.py +32 -0
  12. hvplot/interactive.py +968 -0
  13. hvplot/networkx.py +625 -0
  14. hvplot/pandas.py +30 -0
  15. hvplot/plotting/__init__.py +63 -0
  16. hvplot/plotting/andrews_curves.py +99 -0
  17. hvplot/plotting/core.py +2288 -0
  18. hvplot/plotting/lag_plot.py +34 -0
  19. hvplot/plotting/parallel_coordinates.py +85 -0
  20. hvplot/plotting/scatter_matrix.py +220 -0
  21. hvplot/polars.py +21 -0
  22. hvplot/sample_data.py +30 -0
  23. hvplot/streamz.py +21 -0
  24. hvplot/tests/__init__.py +0 -0
  25. hvplot/tests/conftest.py +44 -0
  26. hvplot/tests/data/README.md +5 -0
  27. hvplot/tests/data/RGB-red.byte.tif +0 -0
  28. hvplot/tests/plotting/__init__.py +0 -0
  29. hvplot/tests/plotting/testcore.py +108 -0
  30. hvplot/tests/plotting/testohlc.py +34 -0
  31. hvplot/tests/plotting/testscattermatrix.py +138 -0
  32. hvplot/tests/test_links.py +99 -0
  33. hvplot/tests/testbackend_transforms.py +89 -0
  34. hvplot/tests/testcharts.py +452 -0
  35. hvplot/tests/testfugue.py +46 -0
  36. hvplot/tests/testgeo.py +468 -0
  37. hvplot/tests/testgeowithoutgv.py +60 -0
  38. hvplot/tests/testgridplots.py +259 -0
  39. hvplot/tests/testhelp.py +75 -0
  40. hvplot/tests/testibis.py +17 -0
  41. hvplot/tests/testinteractive.py +1442 -0
  42. hvplot/tests/testnetworkx.py +26 -0
  43. hvplot/tests/testoperations.py +385 -0
  44. hvplot/tests/testoptions.py +596 -0
  45. hvplot/tests/testoverrides.py +74 -0
  46. hvplot/tests/testpanel.py +70 -0
  47. hvplot/tests/testpatch.py +135 -0
  48. hvplot/tests/testplotting.py +69 -0
  49. hvplot/tests/teststreaming.py +28 -0
  50. hvplot/tests/testtransforms.py +39 -0
  51. hvplot/tests/testui.py +383 -0
  52. hvplot/tests/testutil.py +378 -0
  53. hvplot/tests/util.py +82 -0
  54. hvplot/ui.py +1032 -0
  55. hvplot/util.py +677 -0
  56. hvplot/utilities.py +129 -0
  57. hvplot/xarray.py +62 -0
  58. hvplot-0.9.3a1.dist-info/LICENSE +29 -0
  59. hvplot-0.9.3a1.dist-info/METADATA +243 -0
  60. hvplot-0.9.3a1.dist-info/RECORD +63 -0
  61. hvplot-0.9.3a1.dist-info/WHEEL +5 -0
  62. hvplot-0.9.3a1.dist-info/entry_points.txt +2 -0
  63. hvplot-0.9.3a1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,63 @@
1
+ import holoviews as hv
2
+ from ..util import with_hv_extension, is_polars
3
+
4
+ from .core import hvPlot, hvPlotTabular # noqa
5
+
6
+ from .andrews_curves import andrews_curves # noqa
7
+ from .parallel_coordinates import parallel_coordinates # noqa
8
+ from .lag_plot import lag_plot # noqa
9
+ from .scatter_matrix import scatter_matrix # noqa
10
+
11
+
12
+ @with_hv_extension
13
+ def plot(data, kind, **kwargs):
14
+ # drop reuse_plot
15
+ kwargs.pop('reuse_plot', None)
16
+
17
+ # replace with shared_axes
18
+ sharex = kwargs.pop('sharex', None)
19
+ sharey = kwargs.pop('sharey', None)
20
+ if sharex is not None and sharey is not None:
21
+ kwargs['shared_axes'] = sharex or sharey
22
+ elif sharex is not None:
23
+ kwargs['shared_axes'] = sharex
24
+ elif sharey is not None:
25
+ kwargs['shared_axes'] = sharey
26
+
27
+ # drop all kwargs that are set to None
28
+ no_none_kwargs = {}
29
+ for k, v in kwargs.items():
30
+ if v is not None:
31
+ no_none_kwargs[k] = v
32
+
33
+ if is_polars(data):
34
+ from .core import hvPlotTabularPolars
35
+
36
+ return hvPlotTabularPolars(data)(kind=kind, **no_none_kwargs)
37
+ return hvPlotTabular(data)(kind=kind, **no_none_kwargs)
38
+
39
+
40
+ def boxplot_series(*args, **kwargs):
41
+ return plot(*args, kind='box', **kwargs)
42
+
43
+
44
+ def boxplot_frame(*args, **kwargs):
45
+ return plot(*args, kind='box', **kwargs)
46
+
47
+
48
+ def boxplot_frame_groupby(grouped, **kwargs):
49
+ width = kwargs.pop('width', 300)
50
+ subplots = kwargs.pop('subplots', True)
51
+ layout = hv.Layout if subplots else hv.Overlay
52
+ plots = [
53
+ plot(data=data, kind='box', title=name, width=width, **kwargs) for name, data in grouped
54
+ ]
55
+ return layout(plots)
56
+
57
+
58
+ def hist_series(*args, **kwargs):
59
+ return plot(*args, kind='hist', **kwargs)
60
+
61
+
62
+ def hist_frame(*args, **kwargs):
63
+ return plot(*args, kind='hist', **kwargs)
@@ -0,0 +1,99 @@
1
+ import numpy as np
2
+ import pandas as pd
3
+
4
+ import holoviews as hv
5
+ import colorcet as cc
6
+
7
+ from ..backend_transforms import _transfer_opts_cur_backend
8
+ from ..util import with_hv_extension
9
+
10
+
11
+ @with_hv_extension
12
+ def andrews_curves(
13
+ data,
14
+ class_column,
15
+ samples=200,
16
+ alpha=0.5,
17
+ width=600,
18
+ height=300,
19
+ cmap=None,
20
+ colormap=None,
21
+ **kwds,
22
+ ):
23
+ """
24
+ Generate a plot of Andrews curves, for visualising clusters of
25
+ multivariate data.
26
+
27
+ Andrews curves have the functional form:
28
+
29
+ f(t) = x_1/sqrt(2) + x_2 sin(t) + x_3 cos(t) +
30
+ x_4 sin(2t) + x_5 cos(2t) + ...
31
+
32
+ Where x coefficients correspond to the values of each dimension and t is
33
+ linearly spaced between -pi and +pi. Each row of frame then corresponds to
34
+ a single curve.
35
+
36
+ Parameters
37
+ ----------
38
+ frame: DataFrame
39
+ Data to be plotted, preferably normalized to (0.0, 1.0)
40
+ class_column: str
41
+ Column name containing class names
42
+ samples: int, optional
43
+ Number of samples to draw
44
+ alpha: float, optional
45
+ The transparency of the lines
46
+ cmap/colormap: str or colormap object
47
+ Colormap to use for groups
48
+
49
+ Returns
50
+ -------
51
+ obj : HoloViews object
52
+ The HoloViews representation of the plot.
53
+
54
+ See Also
55
+ --------
56
+ pandas.plotting.parallel_coordinates : matplotlib version of this routine
57
+ """
58
+ t = np.linspace(-np.pi, np.pi, samples)
59
+ vals = data.drop(class_column, axis=1).values.T
60
+
61
+ curves = np.outer(vals[0], np.ones_like(t))
62
+ for i in range(1, len(vals)):
63
+ ft = ((i + 1) // 2) * t
64
+ if i % 2 == 1:
65
+ curves += np.outer(vals[i], np.sin(ft))
66
+ else:
67
+ curves += np.outer(vals[i], np.cos(ft))
68
+
69
+ df = pd.DataFrame(
70
+ {
71
+ 't': np.tile(np.arange(samples), curves.shape[0]),
72
+ 'sample': np.repeat(np.arange(curves.shape[0]), curves.shape[1]),
73
+ 'value': curves.ravel(),
74
+ class_column: np.repeat(data[class_column], samples),
75
+ }
76
+ )
77
+
78
+ labelled = ['x']
79
+ options = {
80
+ 'Overlay': dict(legend_limit=5000),
81
+ 'Curve': dict(kwds, labelled=labelled, alpha=alpha, width=width, height=height, **kwds),
82
+ }
83
+ dataset = hv.Dataset(df)
84
+ groups = dataset.to(hv.Curve, 't', 'value').overlay('sample').items()
85
+
86
+ if cmap and colormap:
87
+ raise TypeError('Only specify one of `cmap` and `colormap`.')
88
+ cmap = cmap or colormap or cc.palette['glasbey_category10']
89
+ colors = hv.plotting.util.process_cmap(cmap, categorical=True, ncolors=len(groups))
90
+
91
+ el = hv.Overlay(
92
+ [
93
+ curve.relabel(k).options('Curve', color=c, backend='bokeh')
94
+ for c, (k, v) in zip(colors, groups)
95
+ for curve in v
96
+ ]
97
+ ).options(options, backend='bokeh')
98
+ el = _transfer_opts_cur_backend(el)
99
+ return el