hiveplotlib 0.25.0__tar.gz → 0.26.0__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.0 → hiveplotlib-0.26.0}/LICENSE +3 -3
  2. {hiveplotlib-0.25.0/src/hiveplotlib.egg-info → hiveplotlib-0.26.0}/PKG-INFO +50 -35
  3. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/README.md +30 -26
  4. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/pyproject.toml +23 -11
  5. hiveplotlib-0.26.0/src/hiveplotlib/__init__.py +16 -0
  6. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/src/hiveplotlib/axis.py +96 -25
  7. hiveplotlib-0.26.0/src/hiveplotlib/converters.py +41 -0
  8. hiveplotlib-0.26.0/src/hiveplotlib/datasets/__init__.py +21 -0
  9. hiveplotlib-0.26.0/src/hiveplotlib/datasets/international_trade.py +76 -0
  10. hiveplotlib-0.26.0/src/hiveplotlib/datasets/toy_hive_plots.py +331 -0
  11. hiveplotlib-0.26.0/src/hiveplotlib/datasets/toy_p2cps.py +117 -0
  12. hiveplotlib-0.26.0/src/hiveplotlib/edges.py +311 -0
  13. hiveplotlib-0.26.0/src/hiveplotlib/exceptions/__init__.py +6 -0
  14. hiveplotlib-0.26.0/src/hiveplotlib/exceptions/hive_plot.py +74 -0
  15. hiveplotlib-0.26.0/src/hiveplotlib/exceptions/node.py +11 -0
  16. hiveplotlib-0.26.0/src/hiveplotlib/hiveplot.py +4073 -0
  17. hiveplotlib-0.26.0/src/hiveplotlib/node.py +454 -0
  18. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/src/hiveplotlib/p2cp.py +75 -72
  19. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/src/hiveplotlib/viz/__init__.py +1 -1
  20. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/src/hiveplotlib/viz/base.py +149 -18
  21. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/src/hiveplotlib/viz/bokeh.py +344 -52
  22. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/src/hiveplotlib/viz/datashader.py +174 -84
  23. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/src/hiveplotlib/viz/holoviews.py +407 -55
  24. hiveplotlib-0.26.0/src/hiveplotlib/viz/input_checks.py +131 -0
  25. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/src/hiveplotlib/viz/matplotlib.py +170 -36
  26. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/src/hiveplotlib/viz/plotly.py +396 -71
  27. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0/src/hiveplotlib.egg-info}/PKG-INFO +50 -35
  28. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/src/hiveplotlib.egg-info/SOURCES.txt +7 -0
  29. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/src/hiveplotlib.egg-info/requires.txt +13 -5
  30. hiveplotlib-0.25.0/src/hiveplotlib/__init__.py +0 -10
  31. hiveplotlib-0.25.0/src/hiveplotlib/converters.py +0 -29
  32. hiveplotlib-0.25.0/src/hiveplotlib/datasets/__init__.py +0 -317
  33. hiveplotlib-0.25.0/src/hiveplotlib/hiveplot.py +0 -1524
  34. hiveplotlib-0.25.0/src/hiveplotlib/node.py +0 -173
  35. hiveplotlib-0.25.0/src/hiveplotlib/viz/input_checks.py +0 -99
  36. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/MANIFEST.in +0 -0
  37. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/setup.cfg +0 -0
  38. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/setup.py +0 -0
  39. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/src/hiveplotlib/datasets/trade_data_harvard_growth_lab/international_exports_2019_8112.csv +0 -0
  40. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/src/hiveplotlib/datasets/trade_data_harvard_growth_lab/international_exports_metadata_2019_8112.json +0 -0
  41. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/src/hiveplotlib/utils.py +0 -0
  42. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/src/hiveplotlib.egg-info/dependency_links.txt +0 -0
  43. {hiveplotlib-0.25.0 → hiveplotlib-0.26.0}/src/hiveplotlib.egg-info/top_level.txt +0 -0
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020 - 2023, Geometric Data Analytics, Inc.
1
+ Copyright (c) 2020 - 2024, Geometric Data Analytics, Inc.
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification,
@@ -11,7 +11,7 @@ Redistributions in binary form must reproduce the above copyright notice,
11
11
  this list of conditions and the following disclaimer in the documentation
12
12
  and/or other materials provided with the distribution.
13
13
 
14
- Neither the name of Anaconda nor the names of any contributors
14
+ Neither the name of Geometric Data Analytics nor the names of any contributors
15
15
  may be used to endorse or promote products derived from this software
16
16
  without specific prior written permission.
17
17
 
@@ -25,4 +25,4 @@ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
25
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
26
  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
27
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28
- THE POSSIBILITY OF SUCH DAMAGE.
28
+ THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,9 +1,9 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: hiveplotlib
3
- Version: 0.25.0
3
+ Version: 0.26.0
4
4
  Summary: Visualize Network Data with Hive Plots
5
5
  Author-email: Gary Koplik <gary.koplik@geomdata.com>
6
- License: Copyright (c) 2020 - 2023, Geometric Data Analytics, Inc.
6
+ License: Copyright (c) 2020 - 2024, Geometric Data Analytics, Inc.
7
7
  All rights reserved.
8
8
 
9
9
  Redistribution and use in source and binary forms, with or without modification,
@@ -16,7 +16,7 @@ License: Copyright (c) 2020 - 2023, Geometric Data Analytics, Inc.
16
16
  this list of conditions and the following disclaimer in the documentation
17
17
  and/or other materials provided with the distribution.
18
18
 
19
- Neither the name of Anaconda nor the names of any contributors
19
+ Neither the name of Geometric Data Analytics nor the names of any contributors
20
20
  may be used to endorse or promote products derived from this software
21
21
  without specific prior written permission.
22
22
 
@@ -31,8 +31,10 @@ License: Copyright (c) 2020 - 2023, Geometric Data Analytics, Inc.
31
31
  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32
32
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
33
33
  THE POSSIBILITY OF SUCH DAMAGE.
34
+
34
35
  Project-URL: Documentation, https://hiveplotlib.readthedocs.io/stable/
35
36
  Project-URL: Source, https://gitlab.com/geomdata/hiveplotlib
37
+ Requires-Python: >=3.9
36
38
  Description-Content-Type: text/markdown
37
39
  License-File: LICENSE
38
40
  Requires-Dist: matplotlib
@@ -43,27 +45,34 @@ Requires-Dist: bokeh; extra == "bokeh"
43
45
  Provides-Extra: datashader
44
46
  Requires-Dist: dask[dataframe]; extra == "datashader"
45
47
  Requires-Dist: datashader; extra == "datashader"
48
+ Requires-Dist: numba>0.54.0; extra == "datashader"
46
49
  Requires-Dist: seaborn; extra == "datashader"
47
50
  Provides-Extra: dev
48
- Requires-Dist: bokeh; extra == "dev"
51
+ Requires-Dist: bokeh<3.7.0; extra == "dev"
49
52
  Requires-Dist: cartopy; extra == "dev"
53
+ Requires-Dist: dask[dataframe]; extra == "dev"
50
54
  Requires-Dist: datashader; extra == "dev"
51
- Requires-Dist: geopandas; extra == "dev"
52
55
  Requires-Dist: flexitext; extra == "dev"
53
- Requires-Dist: holoviews; extra == "dev"
56
+ Requires-Dist: geopandas; extra == "dev"
57
+ Requires-Dist: holoviews<1.20.2; extra == "dev"
54
58
  Requires-Dist: jupyter; extra == "dev"
55
59
  Requires-Dist: networkx; extra == "dev"
60
+ Requires-Dist: numba>0.54.0; extra == "dev"
56
61
  Requires-Dist: plotly; extra == "dev"
57
62
  Requires-Dist: pybadges; extra == "dev"
58
63
  Requires-Dist: seaborn; extra == "dev"
59
64
  Requires-Dist: tqdm; extra == "dev"
60
65
  Provides-Extra: docs
66
+ Requires-Dist: myst-parser; extra == "docs"
61
67
  Requires-Dist: nbsphinx; extra == "docs"
68
+ Requires-Dist: pydata-sphinx-theme; extra == "docs"
62
69
  Requires-Dist: sphinx; extra == "docs"
63
- Requires-Dist: sphinx-rtd-theme; extra == "docs"
70
+ Requires-Dist: sphinx-copybutton; extra == "docs"
64
71
  Requires-Dist: toml; extra == "docs"
65
72
  Provides-Extra: holoviews
66
- 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"
67
76
  Provides-Extra: networkx
68
77
  Requires-Dist: networkx; extra == "networkx"
69
78
  Provides-Extra: plotly
@@ -76,31 +85,33 @@ Requires-Dist: pytest-cov; extra == "testing"
76
85
  Requires-Dist: pytest-html; extra == "testing"
77
86
  Requires-Dist: pytest-timeout; extra == "testing"
78
87
  Requires-Dist: pytest-xdist; extra == "testing"
88
+ Requires-Dist: toml; extra == "testing"
89
+ Dynamic: license-file
79
90
 
80
- ![](https://hiveplotlib.readthedocs.io/stable/_static/hiveplotlib.svg)
91
+ ![Hiveplotlib Logo](https://hiveplotlib.readthedocs.io/stable/_static/hiveplotlib.svg)
81
92
 
82
- A plotting package for generating and visualizing static Hive Plots in `matplotlib`.
93
+ A plotting package for generating and visualizing static Hive Plots in Python.
83
94
 
84
- ![](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)
85
96
 
86
- [![](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/matplotlib_badge.svg)](https://matplotlib.org/)
87
- [![](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/bokeh_badge.svg)](https://docs.bokeh.org/en/latest/)
88
- [![](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/holoviews_badge.svg)](https://holoviews.org/index.html)
89
- [![](https://gitlab.com/geomdata/hiveplotlib/-/raw/master/.gitlab/plotly_badge.svg)](https://plotly.com/python/)
90
- [![](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/)
91
102
 
92
103
  # Installation
93
104
 
94
105
  `hiveplotlib` can be installed via [pypi](https://pypi.org/project/hiveplotlib/):
95
106
 
96
- ```
97
- $ pip install hiveplotlib
107
+ ```bash
108
+ pip install hiveplotlib
98
109
  ```
99
110
 
100
111
  To uninstall, run:
101
112
 
102
- ```
103
- $ pip uninstall hiveplotlib
113
+ ```bash
114
+ pip uninstall hiveplotlib
104
115
  ```
105
116
 
106
117
  By default, `hiveplotlib` supports visualization only with the [matplotlib](https://matplotlib.org/) backend, but
@@ -111,32 +122,32 @@ and [plotly](https://plotly.com/python/) visualizations, which can be installed
111
122
  `hiveplotlib` also supports large network visualization via the [datashader](https://datashader.org/) backend,
112
123
  which can be installed as `pip install hiveplotlib[datashader]`.
113
124
 
114
- # Contributing
115
-
116
- For more on contributing to the project, see [CONTRIBUTING.md](https://gitlab.com/geomdata/hiveplotlib/-/blob/master/CONTRIBUTING.md)
117
-
118
125
  # How to Use and Examples
119
126
 
120
127
  For more on how to use the software and examples, see the
121
- [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.
122
134
 
123
135
  All the example notebooks are available for download as `jupyter` notebooks in the repository under the
124
136
  [examples](https://gitlab.com/geomdata/hiveplotlib/-/tree/master/examples) directory.
125
137
 
126
- If trying to run the example notebooks, note that these are maintained to run in the conda
127
- environment in the repository, specified by `hiveplot_env.yml`.
128
-
129
- 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:
130
139
 
140
+ ```bash
141
+ cd <path/to/repository>
142
+ bash install.sh
131
143
  ```
132
- $ cd <path/to/repository>
133
- $ bash install.sh
134
- ```
144
+
145
+ The resulting `hiveplotlib` kernel can run any of those notebooks.
135
146
 
136
147
  # More on Hive Plots
137
148
 
138
149
  For more on Hive Plots, see our
139
- [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).
140
151
 
141
152
  For additional resources, see:
142
153
 
@@ -146,9 +157,13 @@ For additional resources, see:
146
157
  Visualizing Networks. Briefings in Bioinformatics (early access 9 December 2011,
147
158
  doi: 10.1093/bib/bbr069).
148
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
+
149
164
  ## Acknowledgements
150
165
 
151
166
  We'd like to thank Rodrigo Garcia-Herrera for his work on
152
167
  [`pyveplot`](https://gitlab.com/rgarcia-herrera/pyveplot), which we referenced
153
168
  as a starting point for our structural design. We also translated some of his utility
154
- 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
- A plotting package for generating and visualizing static Hive Plots in `matplotlib`.
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.0"
9
+ requires-python = ">=3.9"
10
+ version = "0.26.0"
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))