gecko984 / supervenn Goto Github PK
View Code? Open in Web Editor NEWsupervenn: precise and easy-to-read multiple sets visualization in Python
License: MIT License
supervenn: precise and easy-to-read multiple sets visualization in Python
License: MIT License
Proper handling of intersection sizes as inputs requires a big refactoring #30
Meanwhile, it's easy to add a utility function that will take something like a dataframe like this
is_in_set_1 is_in_set_2 is_in_set_3 size
True True True 123
True True False 456
...
and generate dummy sets that will produce the desired diagram when passed to supervenn(). Something like this
from collections import defaultdict
sets = defaultdict(set)
idx = 0
for _, row in df.iterrows():
flags = row.iloc[:-1]
count = row.iloc[-1]
items = range(idx, idx + count)
for colname, bool_value in flags.iteritems():
if bool_value:
sets[colname].update(items)
idx += count
I'm trying out supervenn
on a dataset I'm working on and noticed some gnarly overlap in the ITEMS
.
What are you recommended settings to visualize this?
from supervenn import supervenn
with plt.style.context("seaborn-white"):
fig, ax = plt.subplots(figsize=(21,13))
supervenn(sets, set_annotations, side_plots=True, ax=ax, chunks_ordering="occurence" )
The labels on plot generated using supervenn are always SET
and ITEMS
. Are there any way to change and put custom labels?
from supervenn import supervenn
sets = [{1, 2, 3, 4}, {3, 4, 5}, {1, 6, 7, 8}]
with plt.style.context("seaborn-white"):
fig, ax = plt.subplots()
supervenn(sets, side_plots=False, ax=ax)
# ---------------------------------------------------------------------------
# TypeError Traceback (most recent call last)
# <ipython-input-61-9074a6cee262> in <module>
# 3 with plt.style.context("seaborn-white"):
# 4 fig, ax = plt.subplots()
# ----> 5 supervenn(sets, side_plots=False, ax=ax)
# ~/anaconda3/envs/soothsayer5_env/lib/python3.8/site-packages/supervenn/_plots.py in supervenn(sets, set_annotations, figsize, side_plots, chunks_ordering, sets_ordering, reverse_chunks_order, reverse_sets_order, max_bruteforce_size, seeds, noise_prob, side_plot_width, min_width_for_annotation, widths_minmax_ratio, side_plot_color, dpi, **kw)
# 323 effective_min_width_for_annotation = min_width_for_annotation
# 324
# --> 325 plot_binary_array(
# 326 arr=composition_array,
# 327 row_annotations=set_annotations,
# TypeError: plot_binary_array() got multiple values for keyword argument 'ax'
Right now it's not practical to use these in a production setting because we can't integrate these into existing figures.
Hi, thanks for this great package! I was wondering if there is an easy way to hide exclusive chunks (i.e. chunks that exist only in a single set)?
It would be great have an option named "chunks_min_set_overlap" which defaults to 1, meaning that exclusive chunks are plotted and raising it to 2 would plot only the chunks present in at least two sets.
Is there / what is the difference between white and gray color of rows? - outside of the overlap chunks. If there is no difference, is there a way to assign a single color to the background, like all white or all grey? Thanks!
Use an interactive plotting library like bokeh or plotly to display the same data interactively.
Requires a huge refactoring, and an investigation of which library will suit the task better
Hi,
Great work, it helps me a lot !
Altair and vega-lite is lack of a venndiagram, hope supervenn can be integrated.
vega/altair#2749
supervenn has already been super useful for my work, and having supervenn._plots.supervenn return chunks
would allow for more downstream EDA.
this can be useful to add one more layer of information to the chart. colors_cycle
argument kinda allows that, but if sets_ordering is not None, the colors wont be permutated in the same way as the sets
I am trying to achieve the following:
Are these changes possible and if so, how?
Hey, this is a cool package!
While maybe impractical for larger sets where numbers are best, is it possible to include elements' names in the visualization?
Given say a seven-set scenario with five elements in each, it might be helpful to actually be able to see the names of the elements that are unique or in common, rather than only have the anonymous "2" elements in common or unique.
Is that already possible?
Cheers,
Haakon
Hi,
I found the super venn diagram very helpful as it can handle data with many sets. Is it possible to have a function to stretch and bend the rectangular plot to a donut plot (circular)? Sometimes, a donut plot is visually more appealing. It doesn't require any rearrangement of the chunks or rows, maybe just changing from a Cartesian coordinate system to a ploar coordinate system.
Thanks!
Perhaps I am doing something really stupid here, but I just wanted first to reproduce the very basic example first. I installed the package and created a python script with the following lines:
from supervenn import supervenn
sets = [{1, 2, 3, 4}, {3, 4, 5}, {1, 6, 7, 8}]
supervenn(sets, side_plots=False)
Now I run it - and nothing happens! The script just terminates and I am unable to find resulting picture anywhere. What am I doing wrong?
Somehow the row_heights default value is set when the function is called. Rendering the if statement dealing with no given row_height useless. However, when i want to add a custom row_height it gives me this error: "TypeError: supervenn._plots.plot_binary_array() got multiple values for keyword argument 'row_heights'".
I think the issue is solvable by just deleting row 454.
Upload to https://zenodo.org/ so I can cite Supervenn properly in a scientific paper. You get a badge for github as well!
Is there a way to restrict the visualisation to a certain degree? For eg, I have 12 sets, visualising all of them together takes a lot of time and the graph is extremely dense to look at. Can I restrict the overlap degree to 3? That is, I'll see overlapts upto only 3 sets.
Hey, great package!
I'm struggeling to set the font size of the names of the sets displayed in the middle of the bars. I manage to access the axis to set the size of x and y label.
How can I access the other text elements to set their size?
Hi Fedor,
Thank you for this tool, it is very useful and well documented!
There is a typo error in the readme during the presentation of the min_width_for_annotation argument. The argument widths_minmax_ratio
is used instead of min_width_for_annotation
in the python code block.
Call two sets connected, if they have at least one element in common.
Break the sets into connected components first. Each component will have its own chunks, and so each component's chunks can be rearranged separately.
Finding the connected components can be done using the DSU algorithm. We'll be making sets of sets. Start with all sets being a component on its own. Then take one element from each chunk and call union on all sets that this chunk contains
For smaller datasets, it could be beneficial to see actual contents of each chunk at the X axis, with 90 degrees rotation
currently they can have different lens
Requires a huge refactoring, but is definitely useful. For example when the sets are huge (millions of items), but we can get the intersection sizes from some big data tool.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.