hiveplotlib 0.25.1__tar.gz → 0.26.0rc1__tar.gz

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 (43) hide show
  1. {hiveplotlib-0.25.1/src/hiveplotlib.egg-info → hiveplotlib-0.26.0rc1}/PKG-INFO +46 -32
  2. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/README.md +29 -25
  3. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/pyproject.toml +23 -11
  4. hiveplotlib-0.26.0rc1/src/hiveplotlib/__init__.py +16 -0
  5. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/src/hiveplotlib/axis.py +96 -25
  6. hiveplotlib-0.26.0rc1/src/hiveplotlib/converters.py +41 -0
  7. hiveplotlib-0.26.0rc1/src/hiveplotlib/datasets/__init__.py +21 -0
  8. hiveplotlib-0.26.0rc1/src/hiveplotlib/datasets/international_trade.py +76 -0
  9. hiveplotlib-0.26.0rc1/src/hiveplotlib/datasets/toy_hive_plots.py +331 -0
  10. hiveplotlib-0.26.0rc1/src/hiveplotlib/datasets/toy_p2cps.py +117 -0
  11. hiveplotlib-0.26.0rc1/src/hiveplotlib/edges.py +311 -0
  12. hiveplotlib-0.26.0rc1/src/hiveplotlib/exceptions/__init__.py +6 -0
  13. hiveplotlib-0.26.0rc1/src/hiveplotlib/exceptions/hive_plot.py +74 -0
  14. hiveplotlib-0.26.0rc1/src/hiveplotlib/exceptions/node.py +11 -0
  15. hiveplotlib-0.26.0rc1/src/hiveplotlib/hiveplot.py +4073 -0
  16. hiveplotlib-0.26.0rc1/src/hiveplotlib/node.py +454 -0
  17. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/src/hiveplotlib/p2cp.py +75 -72
  18. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/src/hiveplotlib/viz/__init__.py +1 -1
  19. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/src/hiveplotlib/viz/base.py +149 -18
  20. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/src/hiveplotlib/viz/bokeh.py +343 -51
  21. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/src/hiveplotlib/viz/datashader.py +174 -84
  22. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/src/hiveplotlib/viz/holoviews.py +407 -55
  23. hiveplotlib-0.26.0rc1/src/hiveplotlib/viz/input_checks.py +131 -0
  24. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/src/hiveplotlib/viz/matplotlib.py +170 -36
  25. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/src/hiveplotlib/viz/plotly.py +395 -70
  26. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1/src/hiveplotlib.egg-info}/PKG-INFO +46 -32
  27. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/src/hiveplotlib.egg-info/SOURCES.txt +7 -0
  28. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/src/hiveplotlib.egg-info/requires.txt +13 -5
  29. hiveplotlib-0.25.1/src/hiveplotlib/__init__.py +0 -10
  30. hiveplotlib-0.25.1/src/hiveplotlib/converters.py +0 -29
  31. hiveplotlib-0.25.1/src/hiveplotlib/datasets/__init__.py +0 -317
  32. hiveplotlib-0.25.1/src/hiveplotlib/hiveplot.py +0 -1524
  33. hiveplotlib-0.25.1/src/hiveplotlib/node.py +0 -173
  34. hiveplotlib-0.25.1/src/hiveplotlib/viz/input_checks.py +0 -99
  35. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/LICENSE +0 -0
  36. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/MANIFEST.in +0 -0
  37. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/setup.cfg +0 -0
  38. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/setup.py +0 -0
  39. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/src/hiveplotlib/datasets/trade_data_harvard_growth_lab/international_exports_2019_8112.csv +0 -0
  40. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/src/hiveplotlib/datasets/trade_data_harvard_growth_lab/international_exports_metadata_2019_8112.json +0 -0
  41. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/src/hiveplotlib/utils.py +0 -0
  42. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/src/hiveplotlib.egg-info/dependency_links.txt +0 -0
  43. {hiveplotlib-0.25.1 → hiveplotlib-0.26.0rc1}/src/hiveplotlib.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: hiveplotlib
3
- Version: 0.25.1
3
+ Version: 0.26.0rc1
4
4
  Summary: Visualize Network Data with Hive Plots
5
5
  Author-email: Gary Koplik <gary.koplik@geomdata.com>
6
6
  License: Copyright (c) 2020 - 2024, Geometric Data Analytics, Inc.
@@ -34,6 +34,7 @@ License: Copyright (c) 2020 - 2024, Geometric Data Analytics, Inc.
34
34
 
35
35
  Project-URL: Documentation, https://hiveplotlib.readthedocs.io/stable/
36
36
  Project-URL: Source, https://gitlab.com/geomdata/hiveplotlib
37
+ Requires-Python: >=3.9
37
38
  Description-Content-Type: text/markdown
38
39
  License-File: LICENSE
39
40
  Requires-Dist: matplotlib
@@ -44,27 +45,34 @@ Requires-Dist: bokeh; extra == "bokeh"
44
45
  Provides-Extra: datashader
45
46
  Requires-Dist: dask[dataframe]; extra == "datashader"
46
47
  Requires-Dist: datashader; extra == "datashader"
48
+ Requires-Dist: numba>0.54.0; extra == "datashader"
47
49
  Requires-Dist: seaborn; extra == "datashader"
48
50
  Provides-Extra: dev
49
- Requires-Dist: bokeh; extra == "dev"
51
+ Requires-Dist: bokeh<3.7.0; extra == "dev"
50
52
  Requires-Dist: cartopy; extra == "dev"
53
+ Requires-Dist: dask[dataframe]; extra == "dev"
51
54
  Requires-Dist: datashader; extra == "dev"
52
- Requires-Dist: geopandas; extra == "dev"
53
55
  Requires-Dist: flexitext; extra == "dev"
54
- Requires-Dist: holoviews; extra == "dev"
56
+ Requires-Dist: geopandas; extra == "dev"
57
+ Requires-Dist: holoviews<1.20.2; extra == "dev"
55
58
  Requires-Dist: jupyter; extra == "dev"
56
59
  Requires-Dist: networkx; extra == "dev"
60
+ Requires-Dist: numba>0.54.0; extra == "dev"
57
61
  Requires-Dist: plotly; extra == "dev"
58
62
  Requires-Dist: pybadges; extra == "dev"
59
63
  Requires-Dist: seaborn; extra == "dev"
60
64
  Requires-Dist: tqdm; extra == "dev"
61
65
  Provides-Extra: docs
66
+ Requires-Dist: myst-parser; extra == "docs"
62
67
  Requires-Dist: nbsphinx; extra == "docs"
68
+ Requires-Dist: pydata-sphinx-theme; extra == "docs"
63
69
  Requires-Dist: sphinx; extra == "docs"
64
- Requires-Dist: sphinx-rtd-theme; extra == "docs"
70
+ Requires-Dist: sphinx-copybutton; extra == "docs"
65
71
  Requires-Dist: toml; extra == "docs"
66
72
  Provides-Extra: holoviews
67
- Requires-Dist: holoviews; extra == "holoviews"
73
+ Requires-Dist: bokeh<3.7.0; extra == "holoviews"
74
+ Requires-Dist: holoviews<1.20.2; extra == "holoviews"
75
+ Requires-Dist: numba>0.54.0; extra == "holoviews"
68
76
  Provides-Extra: networkx
69
77
  Requires-Dist: networkx; extra == "networkx"
70
78
  Provides-Extra: plotly
@@ -77,31 +85,33 @@ Requires-Dist: pytest-cov; extra == "testing"
77
85
  Requires-Dist: pytest-html; extra == "testing"
78
86
  Requires-Dist: pytest-timeout; extra == "testing"
79
87
  Requires-Dist: pytest-xdist; extra == "testing"
88
+ Requires-Dist: toml; extra == "testing"
89
+ Dynamic: license-file
80
90
 
81
- ![](https://hiveplotlib.readthedocs.io/stable/_static/hiveplotlib.svg)
91
+ ![Hiveplotlib Logo](https://hiveplotlib.readthedocs.io/stable/_static/hiveplotlib.svg)
82
92
 
83
93
  A plotting package for generating and visualizing static Hive Plots in Python.
84
94
 
85
- ![](https://gitlab.com/geomdata/hiveplotlib/-/raw/22-add-formal-holoviews-support/.gitlab/python_badge.svg)
95
+ ![Supported Python Versions Matches PSF support](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/python_badge.svg)
86
96
 
87
- [![](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/matplotlib_badge.svg)](https://matplotlib.org/)
88
- [![](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/bokeh_badge.svg)](https://docs.bokeh.org/en/latest/)
89
- [![](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/holoviews_badge.svg)](https://holoviews.org/index.html)
90
- [![](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/plotly_badge.svg)](https://plotly.com/python/)
91
- [![](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/datashader_badge.svg)](https://datashader.org/)
97
+ [![Matplotlib Support](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/matplotlib_badge.svg)](https://matplotlib.org/)
98
+ [![Bokeh Support](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/bokeh_badge.svg)](https://docs.bokeh.org/en/latest/)
99
+ [![Holoviews Support](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/holoviews_badge.svg)](https://holoviews.org/index.html)
100
+ [![Plotly Support](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/plotly_badge.svg)](https://plotly.com/python/)
101
+ [![Datashader Support](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/datashader_badge.svg)](https://datashader.org/)
92
102
 
93
103
  # Installation
94
104
 
95
105
  `hiveplotlib` can be installed via [pypi](https://pypi.org/project/hiveplotlib/):
96
106
 
97
- ```
98
- $ pip install hiveplotlib
107
+ ```bash
108
+ pip install hiveplotlib
99
109
  ```
100
110
 
101
111
  To uninstall, run:
102
112
 
103
- ```
104
- $ pip uninstall hiveplotlib
113
+ ```bash
114
+ pip uninstall hiveplotlib
105
115
  ```
106
116
 
107
117
  By default, `hiveplotlib` supports visualization only with the [matplotlib](https://matplotlib.org/) backend, but
@@ -112,32 +122,32 @@ and [plotly](https://plotly.com/python/) visualizations, which can be installed
112
122
  `hiveplotlib` also supports large network visualization via the [datashader](https://datashader.org/) backend,
113
123
  which can be installed as `pip install hiveplotlib[datashader]`.
114
124
 
115
- # Contributing
116
-
117
- For more on contributing to the project, see [CONTRIBUTING.md](https://gitlab.com/geomdata/hiveplotlib/-/blob/master/CONTRIBUTING.md)
118
-
119
125
  # How to Use and Examples
120
126
 
121
127
  For more on how to use the software and examples, see the
122
- [docs](https://hiveplotlib.readthedocs.io/stable/index.html).
128
+ [tutorials](https://hiveplotlib.readthedocs.io/stable/notebooks/index.html) and
129
+ [gallery examples](https://hiveplotlib.readthedocs.io/stable/gallery_examples/index.html).
130
+
131
+ We recommend starting with our
132
+ [Introduction to Hive Plots](https://hiveplotlib.readthedocs.io/stable/notebooks/introduction_to_hive_plots.html) and
133
+ [Quick Start Hive Plots](https://hiveplotlib.readthedocs.io/stable/notebooks/quick_hive_plots.html) pages.
123
134
 
124
135
  All the example notebooks are available for download as `jupyter` notebooks in the repository under the
125
136
  [examples](https://gitlab.com/geomdata/hiveplotlib/-/tree/master/examples) directory.
126
137
 
127
- If trying to run the example notebooks, note that these are maintained to run in the conda
128
- environment in the repository, specified by `hiveplot_env.yml`.
129
-
130
- To install this `conda` environment and associated `jupyter` kernel, clone the repository and run:
138
+ To install this environment and associated `jupyter` kernel used to run the notebooks, clone the repository and run:
131
139
 
140
+ ```bash
141
+ cd <path/to/repository>
142
+ bash install.sh
132
143
  ```
133
- $ cd <path/to/repository>
134
- $ bash install.sh
135
- ```
144
+
145
+ The resulting `hiveplotlib` kernel can run any of those notebooks.
136
146
 
137
147
  # More on Hive Plots
138
148
 
139
149
  For more on Hive Plots, see our
140
- [Introduction to Hive Plots](https://hiveplotlib.readthedocs.io/stable/introduction_to_hive_plots.html).
150
+ [Introduction to Hive Plots](https://hiveplotlib.readthedocs.io/stable/notebooks/introduction_to_hive_plots.html).
141
151
 
142
152
  For additional resources, see:
143
153
 
@@ -147,9 +157,13 @@ For additional resources, see:
147
157
  Visualizing Networks. Briefings in Bioinformatics (early access 9 December 2011,
148
158
  doi: 10.1093/bib/bbr069).
149
159
 
160
+ # Contributing
161
+
162
+ For more on contributing to the project, see [CONTRIBUTING.md](https://gitlab.com/geomdata/hiveplotlib/-/blob/master/CONTRIBUTING.md)
163
+
150
164
  ## Acknowledgements
151
165
 
152
166
  We'd like to thank Rodrigo Garcia-Herrera for his work on
153
167
  [`pyveplot`](https://gitlab.com/rgarcia-herrera/pyveplot), which we referenced
154
168
  as a starting point for our structural design. We also translated some of his utility
155
- methods for use in this repository.
169
+ methods for use in this repository.
@@ -1,27 +1,27 @@
1
- ![](https://hiveplotlib.readthedocs.io/stable/_static/hiveplotlib.svg)
1
+ ![Hiveplotlib Logo](https://hiveplotlib.readthedocs.io/stable/_static/hiveplotlib.svg)
2
2
 
3
3
  A plotting package for generating and visualizing static Hive Plots in Python.
4
4
 
5
- ![](https://gitlab.com/geomdata/hiveplotlib/-/raw/22-add-formal-holoviews-support/.gitlab/python_badge.svg)
5
+ ![Supported Python Versions Matches PSF support](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/python_badge.svg)
6
6
 
7
- [![](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/matplotlib_badge.svg)](https://matplotlib.org/)
8
- [![](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/bokeh_badge.svg)](https://docs.bokeh.org/en/latest/)
9
- [![](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/holoviews_badge.svg)](https://holoviews.org/index.html)
10
- [![](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/plotly_badge.svg)](https://plotly.com/python/)
11
- [![](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/datashader_badge.svg)](https://datashader.org/)
7
+ [![Matplotlib Support](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/matplotlib_badge.svg)](https://matplotlib.org/)
8
+ [![Bokeh Support](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/bokeh_badge.svg)](https://docs.bokeh.org/en/latest/)
9
+ [![Holoviews Support](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/holoviews_badge.svg)](https://holoviews.org/index.html)
10
+ [![Plotly Support](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/plotly_badge.svg)](https://plotly.com/python/)
11
+ [![Datashader Support](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/datashader_badge.svg)](https://datashader.org/)
12
12
 
13
13
  # Installation
14
14
 
15
15
  `hiveplotlib` can be installed via [pypi](https://pypi.org/project/hiveplotlib/):
16
16
 
17
- ```
18
- $ pip install hiveplotlib
17
+ ```bash
18
+ pip install hiveplotlib
19
19
  ```
20
20
 
21
21
  To uninstall, run:
22
22
 
23
- ```
24
- $ pip uninstall hiveplotlib
23
+ ```bash
24
+ pip uninstall hiveplotlib
25
25
  ```
26
26
 
27
27
  By default, `hiveplotlib` supports visualization only with the [matplotlib](https://matplotlib.org/) backend, but
@@ -32,32 +32,32 @@ and [plotly](https://plotly.com/python/) visualizations, which can be installed
32
32
  `hiveplotlib` also supports large network visualization via the [datashader](https://datashader.org/) backend,
33
33
  which can be installed as `pip install hiveplotlib[datashader]`.
34
34
 
35
- # Contributing
36
-
37
- For more on contributing to the project, see [CONTRIBUTING.md](https://gitlab.com/geomdata/hiveplotlib/-/blob/master/CONTRIBUTING.md)
38
-
39
35
  # How to Use and Examples
40
36
 
41
37
  For more on how to use the software and examples, see the
42
- [docs](https://hiveplotlib.readthedocs.io/stable/index.html).
38
+ [tutorials](https://hiveplotlib.readthedocs.io/stable/notebooks/index.html) and
39
+ [gallery examples](https://hiveplotlib.readthedocs.io/stable/gallery_examples/index.html).
40
+
41
+ We recommend starting with our
42
+ [Introduction to Hive Plots](https://hiveplotlib.readthedocs.io/stable/notebooks/introduction_to_hive_plots.html) and
43
+ [Quick Start Hive Plots](https://hiveplotlib.readthedocs.io/stable/notebooks/quick_hive_plots.html) pages.
43
44
 
44
45
  All the example notebooks are available for download as `jupyter` notebooks in the repository under the
45
46
  [examples](https://gitlab.com/geomdata/hiveplotlib/-/tree/master/examples) directory.
46
47
 
47
- If trying to run the example notebooks, note that these are maintained to run in the conda
48
- environment in the repository, specified by `hiveplot_env.yml`.
48
+ To install this environment and associated `jupyter` kernel used to run the notebooks, clone the repository and run:
49
49
 
50
- To install this `conda` environment and associated `jupyter` kernel, clone the repository and run:
51
-
52
- ```
53
- $ cd <path/to/repository>
54
- $ bash install.sh
50
+ ```bash
51
+ cd <path/to/repository>
52
+ bash install.sh
55
53
  ```
56
54
 
55
+ The resulting `hiveplotlib` kernel can run any of those notebooks.
56
+
57
57
  # More on Hive Plots
58
58
 
59
59
  For more on Hive Plots, see our
60
- [Introduction to Hive Plots](https://hiveplotlib.readthedocs.io/stable/introduction_to_hive_plots.html).
60
+ [Introduction to Hive Plots](https://hiveplotlib.readthedocs.io/stable/notebooks/introduction_to_hive_plots.html).
61
61
 
62
62
  For additional resources, see:
63
63
 
@@ -67,9 +67,13 @@ For additional resources, see:
67
67
  Visualizing Networks. Briefings in Bioinformatics (early access 9 December 2011,
68
68
  doi: 10.1093/bib/bbr069).
69
69
 
70
+ # Contributing
71
+
72
+ For more on contributing to the project, see [CONTRIBUTING.md](https://gitlab.com/geomdata/hiveplotlib/-/blob/master/CONTRIBUTING.md)
73
+
70
74
  ## Acknowledgements
71
75
 
72
76
  We'd like to thank Rodrigo Garcia-Herrera for his work on
73
77
  [`pyveplot`](https://gitlab.com/rgarcia-herrera/pyveplot), which we referenced
74
78
  as a starting point for our structural design. We also translated some of his utility
75
- methods for use in this repository.
79
+ methods for use in this repository.
@@ -6,7 +6,8 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "hiveplotlib"
9
- version = "0.25.1"
9
+ requires-python = ">=3.9"
10
+ version = "0.26.0rc1"
10
11
  authors = [
11
12
  {name="Gary Koplik", email="gary.koplik@geomdata.com"}
12
13
  ]
@@ -31,19 +32,22 @@ bokeh = [
31
32
  datashader = [
32
33
  "dask[dataframe]", # https://github.com/holoviz/datashader/issues/1319
33
34
  "datashader",
35
+ "numba>0.54.0", # https://github.com/numba/numba/issues/9708
34
36
  "seaborn"
35
37
  ]
36
38
 
37
39
  # developer dependencies
38
40
  dev = [
39
- "bokeh",
41
+ "bokeh<3.7.0", # to maintain holoviews compatibility (see note below)
40
42
  "cartopy",
43
+ "dask[dataframe]", # https://github.com/holoviz/datashader/issues/1319
41
44
  "datashader",
42
- "geopandas",
43
45
  "flexitext",
44
- "holoviews",
46
+ "geopandas",
47
+ "holoviews<1.20.2", # to keep from forcing bokeh 3.7 (bokeh 3.6+ dropped python 3.9 compatibility)
45
48
  "jupyter",
46
49
  "networkx",
50
+ "numba>0.54.0", # https://github.com/numba/numba/issues/9708
47
51
  "plotly",
48
52
  "pybadges",
49
53
  "seaborn",
@@ -52,14 +56,18 @@ dev = [
52
56
 
53
57
  # for building documentation
54
58
  docs = [
59
+ "myst-parser",
55
60
  "nbsphinx",
61
+ "pydata-sphinx-theme",
56
62
  "sphinx",
57
- "sphinx-rtd-theme",
58
- "toml"
63
+ "sphinx-copybutton",
64
+ "toml",
59
65
  ]
60
66
 
61
67
  holoviews = [
62
- "holoviews"
68
+ "bokeh<3.7.0", # to maintain holoviews compatibility (see note below)
69
+ "holoviews<1.20.2", # to keep from forcing bokeh 3.7 (bokeh 3.6+ dropped python 3.9 compatibility)
70
+ "numba>0.54.0", # https://github.com/numba/numba/issues/9708
63
71
  ]
64
72
 
65
73
  networkx = [
@@ -80,7 +88,8 @@ testing = [
80
88
  "pytest-cov",
81
89
  "pytest-html",
82
90
  "pytest-timeout",
83
- "pytest-xdist"
91
+ "pytest-xdist",
92
+ "toml",
84
93
  ]
85
94
 
86
95
  [tool.setuptools.packages.find]
@@ -95,7 +104,7 @@ extend-include = ["*.ipynb", "*.pyi"]
95
104
 
96
105
  # Add files here to be completely skipped by ruff.
97
106
  extend-exclude = [
98
- "docs",
107
+ "docs/source/*.ipynb",
99
108
  "sandbox"
100
109
  ]
101
110
 
@@ -107,20 +116,20 @@ target-version = "py311"
107
116
 
108
117
  [tool.ruff.lint]
109
118
  extend-ignore = [
110
- "ANN101", # typing `self` being deprecated (and not particularly useful)
111
119
  "ANN003", # don't require type hints on kwargs (too many possible types to be useful)
112
120
  "D200", # 1-line docstrings will be tolerated
113
121
  "D203", # don't require blank line before class docstring.
114
122
  "D212", # require docstring text starts on the next line after the triple quotes.
115
123
  "E203", # https://black.readthedocs.io/en/stable/faq.html#why-are-flake8-s-e203-and-w503-violated
116
124
  "PD901", # generic `df` name for pandas dataframes will be tolerated
125
+ "B905", # this is a python 3.10 convention, drop ignore when we drop 3.9 support
117
126
  ]
118
127
 
119
128
  extend-select = [
120
129
  "A", # use flake8-builtins (check if variable name shadows python builtin names)
121
130
  "ANN", # use flake8-annotations (checks type annotations)
122
131
  "ARG", # use flake8-unused-arguments (checks for unused arguments)
123
- # "B", # use flake8-bugbear (nice for cleaner code, but appears to only work when min Python constraint is 3.9)
132
+ "B", # use flake8-bugbear (nice for cleaner code)
124
133
  "C4", # use flake8-comprehensions (remove unnecessary literals, generators, lists, etc.)
125
134
  "D", # use pydoc style rules
126
135
  "E", # use pycodestyle warnings
@@ -138,6 +147,9 @@ extend-select = [
138
147
  "W", # use pycodestyle warnings
139
148
  ]
140
149
 
150
+ [tool.ruff.lint.pydocstyle]
151
+ convention = "pep257"
152
+
141
153
  [tool.ruff.lint.pycodestyle]
142
154
  # allow docstrings to go longer
143
155
  max-line-length = 120
@@ -0,0 +1,16 @@
1
+ # __init__.py
2
+
3
+ """
4
+ Sets up high-level imports of basic data structures and static methods.
5
+ """
6
+
7
+ from hiveplotlib.axis import Axis # noqa: F401
8
+ from hiveplotlib.edges import Edges # noqa: F401
9
+ from hiveplotlib.hiveplot import ( # noqa: F401
10
+ SUPPORTED_VIZ_BACKENDS,
11
+ BaseHivePlot,
12
+ HivePlot,
13
+ hive_plot_n_axes,
14
+ )
15
+ from hiveplotlib.node import Node, NodeCollection # noqa: F401
16
+ from hiveplotlib.p2cp import P2CP, p2cp_n_axes # noqa: F401
@@ -4,9 +4,8 @@
4
4
  Definition of ``Axis`` instance and helper static methods for generating and working with ``Axis`` instances.
5
5
  """
6
6
 
7
- from typing import Hashable, List, Optional
7
+ from typing import Hashable, Optional
8
8
 
9
- import numpy as np
10
9
  import pandas as pd
11
10
 
12
11
  from hiveplotlib.utils import polar2cartesian
@@ -58,6 +57,7 @@ class Axis:
58
57
  end: float = 5,
59
58
  angle: float = 0,
60
59
  long_name: Optional[Hashable] = None,
60
+ metadata: Optional[dict] = None,
61
61
  ) -> None:
62
62
  """
63
63
  Initialize ``Axis`` object with start and end positions and angle. Default to axis normalized on [0, 1].
@@ -70,6 +70,8 @@ class Axis:
70
70
  0 degrees points East, 90 degrees points North).
71
71
  :param long_name: longer name for use when labeling on graph (but not for referencing the axis).
72
72
  Default ``None`` sets it to ``axis_id``.
73
+ :param metadata: optional dictionary of metadata to attach to the axis.
74
+ Default ``None`` means no metadata is attached.
73
75
  """
74
76
  self.axis_id = axis_id
75
77
 
@@ -87,23 +89,55 @@ class Axis:
87
89
  self.polar_end = end
88
90
  self.end = polar2cartesian(self.polar_end, self.angle)
89
91
 
90
- # key from each node's data dictionary that we will use to position the node along the `Axis`
91
- self.node_placement_label = None
92
+ # hold the current sorting variable used to place nodes on an axis in a ``HivePlot`` instance.
93
+ self.sorting_variable = None
92
94
 
93
- # hold all the cartesian coordinates, polar rho, and corresponding labels in a pandas dataframe
95
+ # hold all the cartesian coordinates, polar rho, corresponding labels, and node metadata in a pandas dataframe
94
96
  self.node_placements = pd.DataFrame(columns=["x", "y", "unique_id", "rho"])
95
97
 
98
+ # hold the current vmin and vmax used to place nodes on an axis in a ``HivePlot`` instance.
99
+ self.vmin = None
100
+ self.vmax = None
101
+
102
+ # hold whether current vmin and vmax used to place nodes on an axis in a ``HivePlot`` instance were inferred.
103
+ self.inferred_vmin = None
104
+ self.inferred_vmax = None
105
+
106
+ self.metadata = metadata if metadata is not None else {}
107
+
108
+ def __str__(self) -> str:
109
+ """
110
+ Make more human-readable, multiline representation for ``Axis`` instance.
111
+ """
112
+ return (
113
+ f"hiveplotlib.Axis '{self.axis_id}'\n"
114
+ f"Current data vmin: {self.vmin}\n"
115
+ f"Current data vmax: {self.vmax}\n"
116
+ f"Current sorting variable used to place nodes on this axis: '{self.sorting_variable}'\n"
117
+ f"Current polar start: {self.polar_start}\n"
118
+ f"Current polar end: {self.polar_end}\n"
119
+ f"Current angle: {self.angle}\n"
120
+ f"Inferred vmin: {self.inferred_vmin}\n"
121
+ f"Inferred vmax: {self.inferred_vmax}\n"
122
+ f"Long name: '{self.long_name}'"
123
+ )
124
+
96
125
  def __repr__(self) -> str:
97
126
  """
98
- Make printable representation (repr) for ``Axis`` instance.
127
+ Make custom repr for ``Axis`` instance.
99
128
  """
100
- return f"hiveplotlib.Axis {self.axis_id}"
129
+ return (
130
+ f"hiveplotlib.Axis(axis_id='{self.axis_id}', start={self.polar_start}, "
131
+ f"end={self.polar_end}, angle={self.angle}, long_name='{self.long_name}')"
132
+ )
101
133
 
102
- def _set_node_placements(
103
- self, x: List[float], y: List[float], node_ids: List[Hashable], rho: List[float]
134
+ def set_node_placements(
135
+ self,
136
+ placements_df: pd.DataFrame,
137
+ unique_id: Hashable,
104
138
  ) -> None:
105
139
  """
106
- Set ``Axis.node_placements`` to a ``pandas.DataFrame``.
140
+ Set ``Axis.node_placements`` to a ``pandas.DataFrame`` of node placement information with node metadata.
107
141
 
108
142
  Dataframe consists of x cartesian coordinates, y cartesian coordinates, unique node IDs, and polar *rho* values
109
143
  (e.g. distance from the origin).
@@ -112,24 +146,28 @@ class Axis:
112
146
  This is an internal setter method to be called downstream by the ``HivePlot.place_nodes_on_axis()``
113
147
  method.
114
148
 
115
- :param x: ``list-like`` of x cartesian coordinates.
116
- :param y: ``list-like`` of y cartesian coordinates corresponding to x coordinates.
117
- :param node_ids: ``list-like`` of unique node IDs corresponding to x and y coordinates.
118
- :param rho: ``list-like`` of polar coordinate distance values corresponding to x, y, and unique ID values.
149
+ :param placements_df: dataframe of placement information and other node metadata.
150
+ :param unique_id: column corresponding to node unique IDs.
119
151
  :return: ``None``.
120
152
  """
121
- assert (
122
- np.array(x).shape[0]
123
- == np.array(y).shape[0]
124
- == np.array(node_ids).shape[0]
125
- == np.array(rho).shape[0]
126
- ), "Must provide the same number of x values, y values, and node IDs"
127
-
128
- self.node_placements = pd.DataFrame.from_dict(
129
- {"x": x, "y": y, "unique_id": node_ids, "rho": rho}
153
+ assert "x" in placements_df.columns.to_numpy(), (
154
+ "'x' not in `node_df` column names"
155
+ )
156
+ assert "y" in placements_df.columns.to_numpy(), (
157
+ "'y' not in `node_df` column names"
158
+ )
159
+ assert unique_id in placements_df.columns.to_numpy(), (
160
+ f"'{unique_id}' not in `node_df` column names"
161
+ )
162
+ assert "rho" in placements_df.columns.to_numpy(), (
163
+ "'rho' not in `node_df` column names"
130
164
  )
131
165
 
132
- def _set_node_placement_label(self, label: Hashable) -> None:
166
+ self.node_placements = placements_df.copy()
167
+
168
+ return
169
+
170
+ def set_sorting_variable(self, label: Hashable) -> None:
133
171
  """
134
172
  Set which scalar variable in each ``Node`` instance will be used to place each node on the axis when plotting.
135
173
 
@@ -140,4 +178,37 @@ class Axis:
140
178
  :param label: which scalar variable in the node data to reference.
141
179
  :return: ``None``.
142
180
  """
143
- self.node_placement_label = label
181
+ self.sorting_variable = label
182
+
183
+ def set_node_vmin_and_vmax(
184
+ self, vmin: float, vmax: float, inferred_vmin: bool, inferred_vmax: bool
185
+ ) -> None:
186
+ """
187
+ Set the vmin and vmax values used to place nodes on the axis.
188
+
189
+ .. note::
190
+ This is an internal setter method to be called downstream by the ``HivePlot.place_nodes_on_axis()``
191
+ method.
192
+
193
+ :param vmin: all node scalar values less than ``vmin`` would have been set to ``vmin``
194
+ :param vmax: all node scalar values greater than ``vmax`` would have been set to ``vmax``.
195
+ :param inferred_vmin: whether ``vmin`` value was inferred in ``HivePlot.place_nodes_on_axis()``.
196
+ :param inferred_vmax: whether ``vmax`` value was inferred in ``HivePlot.place_nodes_on_axis()``.
197
+ :return: ``None``.
198
+ """
199
+ self.vmin = vmin
200
+ self.vmax = vmax
201
+ self.inferred_vmin = inferred_vmin
202
+ self.inferred_vmax = inferred_vmax
203
+
204
+ def add_metadata(self, metadata: dict) -> None:
205
+ """
206
+ Add metadata to the axis.
207
+
208
+ This method will overwrite existing metadata with the same keys.
209
+
210
+ :param metadata: dictionary of metadata to add to the axis.
211
+ :return: ``None``.
212
+ """
213
+ self.metadata.update(metadata)
214
+ return
@@ -0,0 +1,41 @@
1
+ # converters.py
2
+
3
+ """
4
+ Converters from various data structures to ``hiveplotlib``-ready structures.
5
+ """
6
+
7
+ from typing import Tuple
8
+
9
+ import pandas as pd
10
+
11
+ from hiveplotlib import Edges, Node, NodeCollection
12
+ from hiveplotlib.node import node_collection_from_node_list
13
+
14
+ # say the graph type instead of calling `nx.Graph` to keep networkx dep out of this file.
15
+ NetworkXGraph = "networkx.classes.graph.Graph instance"
16
+
17
+
18
+ def networkx_to_nodes_edges(
19
+ graph: NetworkXGraph,
20
+ unique_id_name: str = "unique_id",
21
+ check_uniqueness: bool = True,
22
+ ) -> Tuple[NodeCollection, Edges]: # type: ignore
23
+ """
24
+ Take a ``networkx`` graph and return ``hiveplotlib``-friendly data structures.
25
+
26
+ Specifically, returns a ``NodeCollection`` instance of node data and an ``Edges`` instance of
27
+ edge data. These outputs can be fed directly into :py:func:`~hiveplotlib.HivePlot`.
28
+
29
+ :param graph: ``networkx`` graph.
30
+ :param unique_id_name: name to use for unique IDs.
31
+ :param check_uniqueness: whether or not to check that provided ``Node`` instances have unique IDs.
32
+ :return: ``list`` of ``Node`` instances, ``(n, 2)`` ``np.ndarray`` of edges.
33
+ """
34
+ nodes = [Node(unique_id=i, data=data) for i, data in list(graph.nodes.data())]
35
+ edge_keys = pd.DataFrame(list(graph.edges.keys()), columns=["from", "to"])
36
+ edge_values = pd.DataFrame(list(graph.edges.values()))
37
+ return node_collection_from_node_list(
38
+ node_list=nodes,
39
+ unique_id_name=unique_id_name,
40
+ check_uniqueness=check_uniqueness,
41
+ ), Edges(data=edge_keys.join(edge_values))
@@ -0,0 +1,21 @@
1
+ # datasets.py
2
+
3
+ """
4
+ Quick example datasets for use in ``hiveplotlib``.
5
+
6
+ For Hive Plots, many excellent network datasets are available online, including many graphs that can be generated using
7
+ `networkx <https://networkx.org/documentation/stable/reference/generators.html>`_ and
8
+ `pytorch-geometric <https://pytorch-geometric.readthedocs.io/en/latest/notes/data_cheatsheet.html#>`_.
9
+ The `Stanford Large Network Dataset Collection <https://snap.stanford.edu/data/>`_ is also a great general source of
10
+ network datasets. If working with ``networkx`` graphs,
11
+ users can also take advantage of the ``hiveplotlib.converters.networkx_to_nodes_edges()`` method to quickly get those
12
+ graphs into a ``hiveplotlib``-ready format.
13
+
14
+ For Polar Parallel Coordinates Plots (P2CPs), many datasets are available through packages including
15
+ `statsmodels <https://www.statsmodels.org/stable/datasets/index.html>`_ and
16
+ `scikit-learn <https://scikit-learn.org/stable/datasets.html>`_.
17
+ """
18
+
19
+ from hiveplotlib.datasets.international_trade import * # noqa: F401, F403
20
+ from hiveplotlib.datasets.toy_hive_plots import * # noqa: F401, F403
21
+ from hiveplotlib.datasets.toy_p2cps import * # noqa: F401, F403