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
hvplot/cudf.py ADDED
@@ -0,0 +1,26 @@
1
+ from .interactive import Interactive
2
+
3
+
4
+ def patch(name='hvplot', interactive='interactive', extension='bokeh', logo=False):
5
+ from . import hvPlotTabular, post_patch
6
+
7
+ try:
8
+ import cudf
9
+ except ImportError:
10
+ raise ImportError('Could not patch plotting API onto cuDF. cuDF could not be imported.')
11
+ _patch_plot = lambda self: hvPlotTabular(self) # noqa: E731
12
+ _patch_plot.__doc__ = hvPlotTabular.__call__.__doc__
13
+ plot_prop = property(_patch_plot)
14
+ setattr(cudf.DataFrame, name, plot_prop)
15
+ setattr(cudf.Series, name, plot_prop)
16
+
17
+ _patch_interactive = lambda self: Interactive(self) # noqa: E731
18
+ _patch_interactive.__doc__ = Interactive.__call__.__doc__
19
+ interactive_prop = property(_patch_interactive)
20
+ setattr(cudf.DataFrame, interactive, interactive_prop)
21
+ setattr(cudf.Series, interactive, interactive_prop)
22
+
23
+ post_patch(extension, logo)
24
+
25
+
26
+ patch()
hvplot/dask.py ADDED
@@ -0,0 +1,42 @@
1
+ import sys
2
+
3
+ from .interactive import Interactive
4
+
5
+
6
+ class DaskInteractive(Interactive):
7
+ @classmethod
8
+ def applies(cls, obj):
9
+ if 'dask.dataframe' in sys.modules:
10
+ import dask.dataframe as dd
11
+
12
+ return isinstance(obj, (dd.Series, dd.DataFrame))
13
+ return False
14
+
15
+ def compute(self):
16
+ self._method = 'compute'
17
+ return self.__call__()
18
+
19
+
20
+ def patch(name='hvplot', interactive='interactive', extension='bokeh', logo=False):
21
+ from . import hvPlotTabular, post_patch
22
+
23
+ try:
24
+ import dask.dataframe as dd
25
+ except ImportError:
26
+ raise ImportError('Could not patch plotting API onto dask. Dask could not be imported.')
27
+ _patch_plot = lambda self: hvPlotTabular(self) # noqa: E731
28
+ _patch_plot.__doc__ = hvPlotTabular.__call__.__doc__
29
+ plot_prop = property(_patch_plot)
30
+ setattr(dd.DataFrame, name, plot_prop)
31
+ setattr(dd.Series, name, plot_prop)
32
+
33
+ _patch_interactive = lambda self: DaskInteractive(self) # noqa: E731
34
+ _patch_interactive.__doc__ = DaskInteractive.__call__.__doc__
35
+ interactive_prop = property(_patch_interactive)
36
+ setattr(dd.DataFrame, interactive, interactive_prop)
37
+ setattr(dd.Series, interactive, interactive_prop)
38
+
39
+ post_patch(extension, logo)
40
+
41
+
42
+ patch()
hvplot/data/crime.csv ADDED
@@ -0,0 +1,56 @@
1
+ Year,Population,Violent crime total,Murder and nonnegligent Manslaughter,Legacy rape /1,Revised rape /2,Robbery,Aggravated assault,Property crime total,Burglary,Larceny-theft,Motor vehicle theft,Violent Crime rate,Murder and nonnegligent manslaughter rate,Legacy rape rate /1,Revised rape rate /2,Robbery rate,Aggravated assault rate,Property crime rate,Burglary rate,Larceny-theft rate,Motor vehicle theft rate
2
+ 1960,179323175,288460,9110,17190,,107840,154320,3095700,912100,1855400,328200,160.9,5.1,9.6,,60.1,86.1,1726.3,508.6,1034.7,183
3
+ 1961,182992000,289390,8740,17220,,106670,156760,3198600,949600,1913000,336000,158.1,4.8,9.4,,58.3,85.7,1747.9,518.9,1045.4,183.6
4
+ 1962,185771000,301510,8530,17550,,110860,164570,3450700,994300,2089600,366800,162.3,4.6,9.4,,59.7,88.6,1857.5,535.2,1124.8,197.4
5
+ 1963,188483000,316970,8640,17650,,116470,174210,3792500,1086400,2297800,408300,168.2,4.6,9.4,,61.8,92.4,2012.1,576.4,1219.1,216.6
6
+ 1964,191141000,364220,9360,21420,,130390,203050,4200400,1213200,2514400,472800,190.6,4.9,11.2,,68.2,106.2,2197.5,634.7,1315.5,247.4
7
+ 1965,193526000,387390,9960,23410,,138690,215330,4352000,1282500,2572600,496900,200.2,5.1,12.1,,71.7,111.3,2248.8,662.7,1329.3,256.8
8
+ 1966,195576000,430180,11040,25820,,157990,235330,4793300,1410100,2822000,561200,220,5.6,13.2,,80.8,120.3,2450.9,721,1442.9,286.9
9
+ 1967,197457000,499930,12240,27620,,202910,257160,5403500,1632100,3111600,659800,253.2,6.2,14,,102.8,130.2,2736.5,826.6,1575.8,334.1
10
+ 1968,199399000,595010,13800,31670,,262840,286700,6125200,1858900,3482700,783600,298.4,6.9,15.9,,131.8,143.8,3071.8,932.3,1746.6,393
11
+ 1969,201385000,661870,14760,37170,,298850,311090,6749000,1981900,3888600,878500,328.7,7.3,18.5,,148.4,154.5,3351.3,984.1,1930.9,436.2
12
+ 1970,203235298,738820,16000,37990,,349860,334970,7359200,2205000,4225800,928400,363.5,7.9,18.7,,172.1,164.8,3621,1084.9,2079.3,456.8
13
+ 1971,206212000,816500,17780,42260,,387700,368760,7771700,2399300,4424200,948200,396,8.6,20.5,,188,178.8,3768.8,1163.5,2145.5,459.8
14
+ 1972,208230000,834900,18670,46850,,376290,393090,7413900,2375500,4151200,887200,401,9,22.5,,180.7,188.8,3560.4,1140.8,1993.6,426.1
15
+ 1973,209851000,875910,19640,51400,,384220,420650,7842200,2565500,4347900,928800,417.4,9.4,24.5,,183.1,200.5,3737,1222.5,2071.9,442.6
16
+ 1974,211392000,974720,20710,55400,,442400,456210,9278700,3039200,5262500,977100,461.1,9.8,26.2,,209.3,215.8,4389.3,1437.7,2489.5,462.2
17
+ 1975,213124000,1039710,20510,56090,,470500,492620,10252700,3265300,5977700,1009600,487.8,9.6,26.3,,220.8,231.1,4810.7,1532.1,2804.8,473.7
18
+ 1976,214659000,1004210,18780,57080,,427810,500530,10345500,3108700,6270800,966000,467.8,8.7,26.6,,199.3,233.2,4819.5,1448.2,2921.3,450
19
+ 1977,216332000,1029580,19120,63500,,412610,534350,9955000,3071500,5905700,977700,475.9,8.8,29.4,,190.7,247,4601.7,1419.8,2729.9,451.9
20
+ 1978,218059000,1085550,19560,67610,,426930,571460,10123400,3128300,5991000,1004100,497.8,9,31,,195.8,262.1,4642.5,1434.6,2747.4,460.5
21
+ 1979,220099000,1208030,21460,76390,,480700,629480,11041500,3327700,6601000,1112800,548.9,9.8,34.7,,218.4,286,5016.6,1511.9,2999.1,505.6
22
+ 1980,225349264,1344520,23040,82990,,565840,672650,12063700,3795200,7136900,1131700,596.6,10.2,36.8,,251.1,298.5,5353.3,1684.1,3167,502.2
23
+ 1981,229465714,1361820,22520,82500,,592910,663900,12061900,3779700,7194400,1087800,593.5,9.8,36,,258.4,289.3,5256.5,1647.2,3135.3,474.1
24
+ 1982,231664458,1322390,21010,78770,,553130,669480,11652000,3447100,7142500,1062400,570.8,9.1,34,,238.8,289,5029.7,1488,3083.1,458.6
25
+ 1983,233791994,1258087,19308,78918,,506567,653294,10850543,3129851,6712759,1007933,538.1,8.3,33.8,,216.7,279.4,4641.1,1338.7,2871.3,431.1
26
+ 1984,235824902,1273282,18692,84233,,485008,685349,10608473,2984434,6591874,1032165,539.9,7.9,35.7,,205.7,290.6,4498.5,1265.5,2795.2,437.7
27
+ 1985,237923795,1327767,18976,87671,,497874,723246,11102590,3073348,6926380,1102862,558.1,8,36.8,,209.3,304,4666.4,1291.7,2911.2,463.5
28
+ 1986,240132887,1489169,20613,91459,,542775,834322,11722700,3241410,7257153,1224137,620.1,8.6,38.1,,226,347.4,4881.8,1349.8,3022.1,509.8
29
+ 1987,242288918,1483999,20096,91111,,517704,855088,12024709,3236184,7499851,1288674,612.5,8.3,37.6,,213.7,352.9,4963,1335.7,3095.4,531.9
30
+ 1988,244498982,1566221,20675,92486,,542968,910092,12356865,3218077,7705872,1432916,640.6,8.5,37.8,,222.1,372.2,5054,1316.2,3151.7,586.1
31
+ 1989,246819230,1646037,21500,94504,,578326,951707,12605412,3168170,7872442,1564800,666.9,8.7,38.3,,234.3,385.6,5107.1,1283.6,3189.6,634
32
+ 1990,249464396,1820127,23438,102555,,639271,1054863,12655486,3073909,7945670,1635907,729.6,9.4,41.1,,256.3,422.9,5073.1,1232.2,3185.1,655.8
33
+ 1991,252153092,1911767,24703,106593,,687732,1092739,12961116,3157150,8142228,1661738,758.2,9.8,42.3,,272.7,433.4,5140.2,1252.1,3229.1,659
34
+ 1992,255029699,1932274,23760,109062,,672478,1126974,12505917,2979884,7915199,1610834,757.7,9.3,42.8,,263.7,441.9,4903.7,1168.4,3103.6,631.6
35
+ 1993,257782608,1926017,24526,106014,,659870,1135607,12218777,2834808,7820909,1563060,747.1,9.5,41.1,,256,440.5,4740,1099.7,3033.9,606.3
36
+ 1994,260327021,1857670,23326,102216,,618949,1113179,12131873,2712774,7879812,1539287,713.6,9,39.3,,237.8,427.6,4660.2,1042.1,3026.9,591.3
37
+ 1995,262803276,1798792,21606,97470,,580509,1099207,12063935,2593784,7997710,1472441,684.5,8.2,37.1,,220.9,418.3,4590.5,987,3043.2,560.3
38
+ 1996,265228572,1688540,19645,96252,,535594,1037049,11805323,2506400,7904685,1394238,636.6,7.4,36.3,,201.9,391,4451,945,2980.3,525.7
39
+ 1997,267783607,1636096,18208,96153,,498534,1023201,11558475,2460526,7743760,1354189,611,6.8,35.9,,186.2,382.1,4316.3,918.8,2891.8,505.7
40
+ 1998,270248003,1533887,16974,93144,,447186,976583,10951827,2332735,7376311,1242781,567.6,6.3,34.5,,165.5,361.4,4052.5,863.2,2729.5,459.9
41
+ 1999,272690813,1426044,15522,89411,,409371,911740,10208334,2100739,6955520,1152075,523,5.7,32.8,,150.1,334.3,3743.6,770.4,2550.7,422.5
42
+ 2000,281421906,1425486,15586,90178,,408016,911706,10182584,2050992,6971590,1160002,506.5,5.5,32,,145,324,3618.3,728.8,2477.3,412.2
43
+ 2001,285317559,1439480,16037,90863,,423557,909023,10437189,2116531,7092267,1228391,504.5,5.6,31.8,,148.5,318.6,3658.1,741.8,2485.7,430.5
44
+ 2002,287973924,1423677,16229,95235,,420806,891407,10455277,2151252,7057379,1246646,494.4,5.6,33.1,,146.1,309.5,3630.6,747,2450.7,432.9
45
+ 2003,290788976,1383676,16528,93883,,414235,859030,10442862,2154834,7026802,1261226,475.8,5.7,32.3,,142.5,295.4,3591.2,741,2416.5,433.7
46
+ 2004,293656842,1360088,16148,95089,,401470,847381,10319386,2144446,6937089,1237851,463.2,5.5,32.4,,136.7,288.6,3514.1,730.3,2362.3,421.5
47
+ 2005,296507061,1390745,16740,94347,,417438,862220,10174754,2155448,6783447,1235859,469,5.6,31.8,,140.8,290.8,3431.5,726.9,2287.8,416.8
48
+ 2006,299398484,1435123,17309,94472,,449246,874096,10019601,2194993,6626363,1198245,479.3,5.8,31.6,,150,292,3346.6,733.1,2213.2,400.2
49
+ 2007,301621157,1422970,17128,92160,,447324,866358,9882212,2190198,6591542,1100472,471.8,5.7,30.6,,148.3,287.2,3276.4,726.1,2185.4,364.9
50
+ 2008,304059724,1394461,16465,90750,,443563,843683,9774152,2228887,6586206,959059,458.6,5.4,29.8,,145.9,277.5,3214.6,733,2166.1,315.4
51
+ 2009,307006550,1325896,15399,89241,,408742,812514,9337060,2203313,6338095,795652,431.9,5,29.1,,133.1,264.7,3041.3,717.7,2064.5,259.2
52
+ 2010,309330219,1251248,14722,85593,,369089,781844,9112625,2168459,6204601,739565,404.5,4.8,27.7,,119.3,252.8,2945.9,701,2005.8,239.1
53
+ 2011,311587816,1206031,14661,84175,,354772,752423,9052743,2185140,6151095,716508,387.1,4.7,27,,113.9,241.5,2905.4,701.3,1974.1,230
54
+ 2012,313873685,1217067,14866,85141,,355051,762009,9001992,2109932,6168874,723186,387.8,4.7,27.1,,113.1,242.8,2868,672.2,1965.4,230.4
55
+ 2013,316497531,1199684,14319,82109,113695,345095,726575,8650761,1931835,6018632,700294,379.1,4.5,25.9,35.9,109,229.6,2733.3,610.4,1901.6,221.3
56
+ 2014,318857056,1197987,14249,84041,116645,325802,741291,8277829,1729806,5858496,689527,375.7,4.5,26.4,36.6,102.2,232.5,2596.1,542.5,1837.3,216.2
hvplot/datasets.yaml ADDED
@@ -0,0 +1,48 @@
1
+ sources:
2
+ airline_flights:
3
+ description: Airline Flight data
4
+ driver: parquet
5
+ cache:
6
+ - argkey: urlpath
7
+ regex: 'assets.holoviews.org/data/'
8
+ type: file
9
+ args:
10
+ urlpath: 's3://assets.holoviews.org/data/airline_flights.parq'
11
+ storage_options:
12
+ anon: true
13
+ client_kwargs: {'region_name': "eu-west-1"}
14
+
15
+ us_crime:
16
+ description: US Crime data
17
+ driver: csv
18
+ args:
19
+ urlpath: '{{ CATALOG_DIR }}/data/crime.csv'
20
+ metadata:
21
+ url: https://web.archive.org/web/20201031163816/https://www.ucrdatatool.gov/Search/Crime/State/StatebyState.cfm
22
+ plots:
23
+ example:
24
+ kind: line
25
+ y: ['Robbery', 'Burglary']
26
+ x: 'Year'
27
+
28
+ landuse:
29
+ description: Image matching given landuse and id from UCMerced_LandUse/Image.
30
+ origin: http://weegee.vision.ucmerced.edu/datasets/landuse.html
31
+ driver: xarray_image
32
+ cache:
33
+ - argkey: urlpath
34
+ regex: 'earth-data/UCMerced_LandUse'
35
+ type: file
36
+ parameters:
37
+ landuse:
38
+ description: which landuse to collect
39
+ type: str
40
+ default: airplane
41
+ id:
42
+ description: which id to collect
43
+ type: int
44
+ default: 0
45
+ args:
46
+ urlpath: "s3://earth-data/UCMerced_LandUse/Images/{{ landuse }}/{{ landuse }}{{ '%02d' % id }}.tif"
47
+ storage_options:
48
+ anon: true
hvplot/fugue.py ADDED
@@ -0,0 +1,64 @@
1
+ """
2
+ Experimental support for fugue.
3
+ """
4
+
5
+ from typing import Any, Dict, Tuple
6
+
7
+ import panel as _pn
8
+
9
+ from . import hvPlotTabular, post_patch
10
+ from .util import _fugue_ipython
11
+
12
+
13
+ def patch(name='hvplot', extension='bokeh', logo=False):
14
+ try:
15
+ from fugue import DataFrames, Outputter
16
+ from fugue.extensions import namespace_candidate, parse_outputter
17
+ except ImportError:
18
+ raise ImportError(
19
+ 'Could not add fugue support as it could not be imported. '
20
+ 'Please make sure you have installed fugue in your environment.'
21
+ )
22
+
23
+ import hvplot.pandas # noqa: F401
24
+
25
+ class _Visualize(Outputter):
26
+ def __init__(self, func: str) -> None:
27
+ super().__init__()
28
+ self._func = func
29
+ getattr(hvPlotTabular, func) # ensure the func exists
30
+
31
+ def process(self, dfs: DataFrames) -> None:
32
+ """
33
+ Process the dataframes and output the result as
34
+ a pn.Column.
35
+
36
+ Parameters:
37
+ -----------
38
+ dfs: fugue.DataFrames
39
+ """
40
+ charts = []
41
+ for df in dfs.values():
42
+ params = dict(self.params)
43
+ opts: Dict[str, Any] = params.pop('opts', {})
44
+ chart = getattr(df.as_pandas().hvplot, self._func)(**params).opts(**opts)
45
+ charts.append(chart)
46
+ col = _pn.Column(*charts)
47
+ try:
48
+ if not _fugue_ipython:
49
+ get_ipython()
50
+ except NameError:
51
+ col.show() # in script
52
+ else:
53
+ from IPython.display import display
54
+
55
+ display(col) # in notebook
56
+
57
+ @parse_outputter.candidate(namespace_candidate(name, lambda x: isinstance(x, str)))
58
+ def _parse_hvplot(obj: Tuple[str, str]) -> Outputter:
59
+ return _Visualize(obj[1])
60
+
61
+ post_patch(extension, logo)
62
+
63
+
64
+ patch()
hvplot/ibis.py ADDED
@@ -0,0 +1,21 @@
1
+ """
2
+ Experimental support for ibis.
3
+ """
4
+
5
+
6
+ def patch(name='hvplot', extension='bokeh', logo=False):
7
+ from . import hvPlotTabular, post_patch
8
+
9
+ try:
10
+ import ibis
11
+ except ImportError:
12
+ raise ImportError('Could not patch plotting API onto ibis. Ibis could not be imported.')
13
+ _patch_plot = lambda self: hvPlotTabular(self) # noqa: E731
14
+ _patch_plot.__doc__ = hvPlotTabular.__call__.__doc__
15
+ patch_property = property(_patch_plot)
16
+ setattr(ibis.Expr, name, patch_property)
17
+
18
+ post_patch(extension, logo)
19
+
20
+
21
+ patch()
hvplot/intake.py ADDED
@@ -0,0 +1,32 @@
1
+ from packaging.version import Version
2
+
3
+ from . import hvPlot, post_patch
4
+
5
+
6
+ def patch(name='hvplot', extension='bokeh', logo=False):
7
+ try:
8
+ import intake
9
+ except ImportError:
10
+ raise ImportError(
11
+ 'Could not patch plotting API onto intake. intake could not be imported.'
12
+ )
13
+
14
+ _patch_plot = lambda self: hvPlot(self) # noqa: E731
15
+ _patch_plot.__doc__ = hvPlot.__call__.__doc__
16
+ patch_property = property(_patch_plot)
17
+ setattr(intake.source.base.DataSource, name, patch_property)
18
+ post_patch(extension, logo)
19
+
20
+
21
+ try:
22
+ import intake.plotting # noqa
23
+
24
+ patch()
25
+ except Exception:
26
+ import intake
27
+
28
+ if Version(intake.__version__) <= Version('0.1.5'):
29
+ patch()
30
+ patch(name='plot')
31
+ else:
32
+ post_patch(extension='bokeh', logo=False)