upsetplot-bombcell 0.10.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 (32) hide show
  1. upsetplot_bombcell-0.10.0/LICENSE +30 -0
  2. upsetplot_bombcell-0.10.0/PKG-INFO +220 -0
  3. upsetplot_bombcell-0.10.0/README.rst +191 -0
  4. upsetplot_bombcell-0.10.0/doc/conf.py +289 -0
  5. upsetplot_bombcell-0.10.0/examples/plot_customize_after_plot.py +22 -0
  6. upsetplot_bombcell-0.10.0/examples/plot_diabetes.py +77 -0
  7. upsetplot_bombcell-0.10.0/examples/plot_discrete.py +39 -0
  8. upsetplot_bombcell-0.10.0/examples/plot_generated.py +52 -0
  9. upsetplot_bombcell-0.10.0/examples/plot_hide.py +42 -0
  10. upsetplot_bombcell-0.10.0/examples/plot_highlight.py +75 -0
  11. upsetplot_bombcell-0.10.0/examples/plot_highlight_categories.py +41 -0
  12. upsetplot_bombcell-0.10.0/examples/plot_missingness.py +23 -0
  13. upsetplot_bombcell-0.10.0/examples/plot_sizing.py +49 -0
  14. upsetplot_bombcell-0.10.0/examples/plot_theming.py +82 -0
  15. upsetplot_bombcell-0.10.0/examples/plot_vertical.py +28 -0
  16. upsetplot_bombcell-0.10.0/pyproject.toml +72 -0
  17. upsetplot_bombcell-0.10.0/setup.cfg +12 -0
  18. upsetplot_bombcell-0.10.0/upsetplot/__init__.py +24 -0
  19. upsetplot_bombcell-0.10.0/upsetplot/data.py +420 -0
  20. upsetplot_bombcell-0.10.0/upsetplot/plotting.py +1158 -0
  21. upsetplot_bombcell-0.10.0/upsetplot/reformat.py +440 -0
  22. upsetplot_bombcell-0.10.0/upsetplot/tests/__init__.py +0 -0
  23. upsetplot_bombcell-0.10.0/upsetplot/tests/test_data.py +238 -0
  24. upsetplot_bombcell-0.10.0/upsetplot/tests/test_examples.py +19 -0
  25. upsetplot_bombcell-0.10.0/upsetplot/tests/test_reformat.py +47 -0
  26. upsetplot_bombcell-0.10.0/upsetplot/tests/test_upsetplot.py +1234 -0
  27. upsetplot_bombcell-0.10.0/upsetplot/util.py +70 -0
  28. upsetplot_bombcell-0.10.0/upsetplot_bombcell.egg-info/PKG-INFO +220 -0
  29. upsetplot_bombcell-0.10.0/upsetplot_bombcell.egg-info/SOURCES.txt +31 -0
  30. upsetplot_bombcell-0.10.0/upsetplot_bombcell.egg-info/dependency_links.txt +1 -0
  31. upsetplot_bombcell-0.10.0/upsetplot_bombcell.egg-info/requires.txt +6 -0
  32. upsetplot_bombcell-0.10.0/upsetplot_bombcell.egg-info/top_level.txt +5 -0
@@ -0,0 +1,30 @@
1
+ New BSD License
2
+
3
+ Copyright (c) 2018-2024 Joel Nothman.
4
+ All rights reserved.
5
+
6
+
7
+ Redistribution and use in source and binary forms, with or without
8
+ modification, are permitted provided that the following conditions are met:
9
+
10
+ a. Redistributions of source code must retain the above copyright notice,
11
+ this list of conditions and the following disclaimer.
12
+ b. Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+ c. The names of the contributors may not be used to endorse or promote
16
+ products derived from this software without specific prior written
17
+ permission.
18
+
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
24
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
30
+ DAMAGE.
@@ -0,0 +1,220 @@
1
+ Metadata-Version: 2.2
2
+ Name: upsetplot-bombcell
3
+ Version: 0.10.0
4
+ Summary: Draw UpSet plots with Pandas and Matplotlib (maintained fork for BombCell)
5
+ Author-email: Joel Nothman <joel.nothman@gmail.com>
6
+ Maintainer-email: Julie Fabre <julie.m.fabre@gmail.com>
7
+ License: BSD-3-Clause
8
+ Project-URL: Homepage, https://github.com/Julie-Fabre/UpSetPlot
9
+ Project-URL: Repository, https://github.com/Julie-Fabre/UpSetPlot
10
+ Project-URL: Issues, https://github.com/Julie-Fabre/UpSetPlot/issues
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: BSD License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Visualization
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/x-rst
23
+ License-File: LICENSE
24
+ Requires-Dist: pandas>=1.0
25
+ Requires-Dist: matplotlib>=3.0
26
+ Provides-Extra: testing
27
+ Requires-Dist: pytest>=2.7; extra == "testing"
28
+ Requires-Dist: pytest-cov; extra == "testing"
29
+
30
+ UpSetPlot documentation
31
+ ============================
32
+
33
+ |version| |licence| |py-versions|
34
+
35
+ |issues| |build| |docs| |coverage|
36
+
37
+ .. note::
38
+
39
+ This is a fork of the `original UpSetPlot repository <https://github.com/jnothman/UpSetPlot>`_,
40
+ which appears to be unmaintained (last updated 3+ years ago). This fork is maintained
41
+ to ensure compatibility with modern pandas versions and for use with
42
+ `BombCell <https://github.com/Julie-Fabre/bombcell>`_.
43
+
44
+ This is another Python implementation of UpSet plots by Lex et al. [Lex2014]_.
45
+ UpSet plots are used to visualise set overlaps; like Venn diagrams but
46
+ more readable. Documentation is at https://upsetplot.readthedocs.io.
47
+
48
+ This ``upsetplot`` library tries to provide a simple interface backed by an
49
+ extensible, object-oriented design.
50
+
51
+ There are many ways to represent the categorisation of data, as covered in
52
+ our `Data Format Guide <https://upsetplot.readthedocs.io/en/stable/formats.html>`_.
53
+
54
+ Our internal input format uses a `pandas.Series` containing counts
55
+ corresponding to subset sizes, where each subset is an intersection of named
56
+ categories. The index of the Series indicates which rows pertain to which
57
+ categories, by having multiple boolean indices, like ``example`` in the
58
+ following::
59
+
60
+ >>> from upsetplot import generate_counts
61
+ >>> example = generate_counts()
62
+ >>> example
63
+ cat0 cat1 cat2
64
+ False False False 56
65
+ True 283
66
+ True False 1279
67
+ True 5882
68
+ True False False 24
69
+ True 90
70
+ True False 429
71
+ True 1957
72
+ Name: value, dtype: int64
73
+
74
+ Then::
75
+
76
+ >>> from upsetplot import plot
77
+ >>> plot(example) # doctest: +SKIP
78
+ >>> from matplotlib import pyplot
79
+ >>> pyplot.show() # doctest: +SKIP
80
+
81
+ makes:
82
+
83
+ .. image:: http://upsetplot.readthedocs.io/en/latest/_images/sphx_glr_plot_generated_001.png
84
+ :target: ../auto_examples/plot_generated.html
85
+
86
+ And you can save the image in various formats::
87
+
88
+ >>> pyplot.savefig("/path/to/myplot.pdf") # doctest: +SKIP
89
+ >>> pyplot.savefig("/path/to/myplot.png") # doctest: +SKIP
90
+
91
+ This plot shows the cardinality of every category combination seen in our data.
92
+ The leftmost column counts items absent from any category. The next three
93
+ columns count items only in ``cat1``, ``cat2`` and ``cat3`` respectively, with
94
+ following columns showing cardinalities for items in each combination of
95
+ exactly two named sets. The rightmost column counts items in all three sets.
96
+
97
+ Rotation
98
+ ........
99
+
100
+ We call the above plot style "horizontal" because the category intersections
101
+ are presented from left to right. `Vertical plots
102
+ <http://upsetplot.readthedocs.io/en/latest/auto_examples/plot_vertical.html>`__
103
+ are also supported!
104
+
105
+ .. image:: http://upsetplot.readthedocs.io/en/latest/_images/sphx_glr_plot_vertical_001.png
106
+ :target: http://upsetplot.readthedocs.io/en/latest/auto_examples/plot_vertical.html
107
+
108
+ Distributions
109
+ .............
110
+
111
+ Providing a DataFrame rather than a Series as input allows us to expressively
112
+ `plot the distribution of variables
113
+ <http://upsetplot.readthedocs.io/en/latest/auto_examples/plot_diabetes.html>`__
114
+ in each subset.
115
+
116
+ .. image:: http://upsetplot.readthedocs.io/en/latest/_images/sphx_glr_plot_diabetes_001.png
117
+ :target: http://upsetplot.readthedocs.io/en/latest/auto_examples/plot_diabetes.html
118
+
119
+ Loading datasets
120
+ ................
121
+
122
+ While the dataset above is randomly generated, you can prepare your own dataset
123
+ for input to upsetplot. A helpful tool is `from_memberships`, which allows
124
+ us to reconstruct the example above by indicating each data point's category
125
+ membership::
126
+
127
+ >>> from upsetplot import from_memberships
128
+ >>> example = from_memberships(
129
+ ... [[],
130
+ ... ['cat2'],
131
+ ... ['cat1'],
132
+ ... ['cat1', 'cat2'],
133
+ ... ['cat0'],
134
+ ... ['cat0', 'cat2'],
135
+ ... ['cat0', 'cat1'],
136
+ ... ['cat0', 'cat1', 'cat2'],
137
+ ... ],
138
+ ... data=[56, 283, 1279, 5882, 24, 90, 429, 1957]
139
+ ... )
140
+ >>> example
141
+ cat0 cat1 cat2
142
+ False False False 56
143
+ True 283
144
+ True False 1279
145
+ True 5882
146
+ True False False 24
147
+ True 90
148
+ True False 429
149
+ True 1957
150
+ dtype: int64
151
+
152
+ See also `from_contents`, another way to describe categorised data, and
153
+ `from_indicators` which allows each category to be indicated by a column in
154
+ the data frame (or a function of the column's data such as whether it is a
155
+ missing value).
156
+
157
+ Installation
158
+ ------------
159
+
160
+ To install the library, you can use `pip`::
161
+
162
+ $ pip install upsetplot
163
+
164
+ Installation requires:
165
+
166
+ * pandas
167
+ * matplotlib >= 2.0
168
+ * seaborn to use `UpSet.add_catplot`
169
+
170
+ It should then be possible to::
171
+
172
+ >>> import upsetplot
173
+
174
+ in Python.
175
+
176
+ Why an alternative to py-upset?
177
+ -------------------------------
178
+
179
+ Probably for petty reasons. It appeared `py-upset
180
+ <https://github.com/ImSoErgodic/py-upset>`_ was not being maintained. Its
181
+ input format was undocumented, inefficient and, IMO, inappropriate. It did not
182
+ facilitate showing plots of each subset's distribution as in Lex et al's work
183
+ introducing UpSet plots. Nor did it include the horizontal bar plots
184
+ illustrated there. It did not support Python 2. I decided it would be easier to
185
+ construct a cleaner version than to fix it.
186
+
187
+ References
188
+ ----------
189
+
190
+ .. [Lex2014] Alexander Lex, Nils Gehlenborg, Hendrik Strobelt, Romain Vuillemot, Hanspeter Pfister,
191
+ *UpSet: Visualization of Intersecting Sets*,
192
+ IEEE Transactions on Visualization and Computer Graphics (InfoVis '14), vol. 20, no. 12, pp. 1983–1992, 2014.
193
+ doi: `doi.org/10.1109/TVCG.2014.2346248 <https://doi.org/10.1109/TVCG.2014.2346248>`_
194
+
195
+
196
+ .. |py-versions| image:: https://img.shields.io/pypi/pyversions/upsetplot.svg
197
+ :alt: Python versions supported
198
+
199
+ .. |version| image:: https://badge.fury.io/py/UpSetPlot.svg
200
+ :alt: Latest version on PyPi
201
+ :target: https://badge.fury.io/py/UpSetPlot
202
+
203
+ .. |build| image:: https://github.com/jnothman/upsetplot/actions/workflows/test.yml/badge.svg
204
+ :alt: Github Workflows CI build status
205
+ :target: https://github.com/jnothman/UpSetPlot/actions/workflows/test.yml
206
+
207
+ .. |issues| image:: https://img.shields.io/github/issues/jnothman/UpSetPlot.svg
208
+ :alt: Issue tracker
209
+ :target: https://github.com/jnothman/UpSetPlot
210
+
211
+ .. |coverage| image:: https://coveralls.io/repos/github/jnothman/UpSetPlot/badge.svg
212
+ :alt: Test coverage
213
+ :target: https://coveralls.io/github/jnothman/UpSetPlot
214
+
215
+ .. |docs| image:: https://readthedocs.org/projects/upsetplot/badge/?version=latest
216
+ :alt: Documentation Status
217
+ :target: https://upsetplot.readthedocs.io/en/latest/?badge=latest
218
+
219
+ .. |licence| image:: https://img.shields.io/badge/Licence-BSD-blue.svg
220
+ :target: https://opensource.org/licenses/BSD-3-Clause
@@ -0,0 +1,191 @@
1
+ UpSetPlot documentation
2
+ ============================
3
+
4
+ |version| |licence| |py-versions|
5
+
6
+ |issues| |build| |docs| |coverage|
7
+
8
+ .. note::
9
+
10
+ This is a fork of the `original UpSetPlot repository <https://github.com/jnothman/UpSetPlot>`_,
11
+ which appears to be unmaintained (last updated 3+ years ago). This fork is maintained
12
+ to ensure compatibility with modern pandas versions and for use with
13
+ `BombCell <https://github.com/Julie-Fabre/bombcell>`_.
14
+
15
+ This is another Python implementation of UpSet plots by Lex et al. [Lex2014]_.
16
+ UpSet plots are used to visualise set overlaps; like Venn diagrams but
17
+ more readable. Documentation is at https://upsetplot.readthedocs.io.
18
+
19
+ This ``upsetplot`` library tries to provide a simple interface backed by an
20
+ extensible, object-oriented design.
21
+
22
+ There are many ways to represent the categorisation of data, as covered in
23
+ our `Data Format Guide <https://upsetplot.readthedocs.io/en/stable/formats.html>`_.
24
+
25
+ Our internal input format uses a `pandas.Series` containing counts
26
+ corresponding to subset sizes, where each subset is an intersection of named
27
+ categories. The index of the Series indicates which rows pertain to which
28
+ categories, by having multiple boolean indices, like ``example`` in the
29
+ following::
30
+
31
+ >>> from upsetplot import generate_counts
32
+ >>> example = generate_counts()
33
+ >>> example
34
+ cat0 cat1 cat2
35
+ False False False 56
36
+ True 283
37
+ True False 1279
38
+ True 5882
39
+ True False False 24
40
+ True 90
41
+ True False 429
42
+ True 1957
43
+ Name: value, dtype: int64
44
+
45
+ Then::
46
+
47
+ >>> from upsetplot import plot
48
+ >>> plot(example) # doctest: +SKIP
49
+ >>> from matplotlib import pyplot
50
+ >>> pyplot.show() # doctest: +SKIP
51
+
52
+ makes:
53
+
54
+ .. image:: http://upsetplot.readthedocs.io/en/latest/_images/sphx_glr_plot_generated_001.png
55
+ :target: ../auto_examples/plot_generated.html
56
+
57
+ And you can save the image in various formats::
58
+
59
+ >>> pyplot.savefig("/path/to/myplot.pdf") # doctest: +SKIP
60
+ >>> pyplot.savefig("/path/to/myplot.png") # doctest: +SKIP
61
+
62
+ This plot shows the cardinality of every category combination seen in our data.
63
+ The leftmost column counts items absent from any category. The next three
64
+ columns count items only in ``cat1``, ``cat2`` and ``cat3`` respectively, with
65
+ following columns showing cardinalities for items in each combination of
66
+ exactly two named sets. The rightmost column counts items in all three sets.
67
+
68
+ Rotation
69
+ ........
70
+
71
+ We call the above plot style "horizontal" because the category intersections
72
+ are presented from left to right. `Vertical plots
73
+ <http://upsetplot.readthedocs.io/en/latest/auto_examples/plot_vertical.html>`__
74
+ are also supported!
75
+
76
+ .. image:: http://upsetplot.readthedocs.io/en/latest/_images/sphx_glr_plot_vertical_001.png
77
+ :target: http://upsetplot.readthedocs.io/en/latest/auto_examples/plot_vertical.html
78
+
79
+ Distributions
80
+ .............
81
+
82
+ Providing a DataFrame rather than a Series as input allows us to expressively
83
+ `plot the distribution of variables
84
+ <http://upsetplot.readthedocs.io/en/latest/auto_examples/plot_diabetes.html>`__
85
+ in each subset.
86
+
87
+ .. image:: http://upsetplot.readthedocs.io/en/latest/_images/sphx_glr_plot_diabetes_001.png
88
+ :target: http://upsetplot.readthedocs.io/en/latest/auto_examples/plot_diabetes.html
89
+
90
+ Loading datasets
91
+ ................
92
+
93
+ While the dataset above is randomly generated, you can prepare your own dataset
94
+ for input to upsetplot. A helpful tool is `from_memberships`, which allows
95
+ us to reconstruct the example above by indicating each data point's category
96
+ membership::
97
+
98
+ >>> from upsetplot import from_memberships
99
+ >>> example = from_memberships(
100
+ ... [[],
101
+ ... ['cat2'],
102
+ ... ['cat1'],
103
+ ... ['cat1', 'cat2'],
104
+ ... ['cat0'],
105
+ ... ['cat0', 'cat2'],
106
+ ... ['cat0', 'cat1'],
107
+ ... ['cat0', 'cat1', 'cat2'],
108
+ ... ],
109
+ ... data=[56, 283, 1279, 5882, 24, 90, 429, 1957]
110
+ ... )
111
+ >>> example
112
+ cat0 cat1 cat2
113
+ False False False 56
114
+ True 283
115
+ True False 1279
116
+ True 5882
117
+ True False False 24
118
+ True 90
119
+ True False 429
120
+ True 1957
121
+ dtype: int64
122
+
123
+ See also `from_contents`, another way to describe categorised data, and
124
+ `from_indicators` which allows each category to be indicated by a column in
125
+ the data frame (or a function of the column's data such as whether it is a
126
+ missing value).
127
+
128
+ Installation
129
+ ------------
130
+
131
+ To install the library, you can use `pip`::
132
+
133
+ $ pip install upsetplot
134
+
135
+ Installation requires:
136
+
137
+ * pandas
138
+ * matplotlib >= 2.0
139
+ * seaborn to use `UpSet.add_catplot`
140
+
141
+ It should then be possible to::
142
+
143
+ >>> import upsetplot
144
+
145
+ in Python.
146
+
147
+ Why an alternative to py-upset?
148
+ -------------------------------
149
+
150
+ Probably for petty reasons. It appeared `py-upset
151
+ <https://github.com/ImSoErgodic/py-upset>`_ was not being maintained. Its
152
+ input format was undocumented, inefficient and, IMO, inappropriate. It did not
153
+ facilitate showing plots of each subset's distribution as in Lex et al's work
154
+ introducing UpSet plots. Nor did it include the horizontal bar plots
155
+ illustrated there. It did not support Python 2. I decided it would be easier to
156
+ construct a cleaner version than to fix it.
157
+
158
+ References
159
+ ----------
160
+
161
+ .. [Lex2014] Alexander Lex, Nils Gehlenborg, Hendrik Strobelt, Romain Vuillemot, Hanspeter Pfister,
162
+ *UpSet: Visualization of Intersecting Sets*,
163
+ IEEE Transactions on Visualization and Computer Graphics (InfoVis '14), vol. 20, no. 12, pp. 1983–1992, 2014.
164
+ doi: `doi.org/10.1109/TVCG.2014.2346248 <https://doi.org/10.1109/TVCG.2014.2346248>`_
165
+
166
+
167
+ .. |py-versions| image:: https://img.shields.io/pypi/pyversions/upsetplot.svg
168
+ :alt: Python versions supported
169
+
170
+ .. |version| image:: https://badge.fury.io/py/UpSetPlot.svg
171
+ :alt: Latest version on PyPi
172
+ :target: https://badge.fury.io/py/UpSetPlot
173
+
174
+ .. |build| image:: https://github.com/jnothman/upsetplot/actions/workflows/test.yml/badge.svg
175
+ :alt: Github Workflows CI build status
176
+ :target: https://github.com/jnothman/UpSetPlot/actions/workflows/test.yml
177
+
178
+ .. |issues| image:: https://img.shields.io/github/issues/jnothman/UpSetPlot.svg
179
+ :alt: Issue tracker
180
+ :target: https://github.com/jnothman/UpSetPlot
181
+
182
+ .. |coverage| image:: https://coveralls.io/repos/github/jnothman/UpSetPlot/badge.svg
183
+ :alt: Test coverage
184
+ :target: https://coveralls.io/github/jnothman/UpSetPlot
185
+
186
+ .. |docs| image:: https://readthedocs.org/projects/upsetplot/badge/?version=latest
187
+ :alt: Documentation Status
188
+ :target: https://upsetplot.readthedocs.io/en/latest/?badge=latest
189
+
190
+ .. |licence| image:: https://img.shields.io/badge/Licence-BSD-blue.svg
191
+ :target: https://opensource.org/licenses/BSD-3-Clause