tctianchi / pyvenn Goto Github PK
View Code? Open in Web Editor NEW2 ~ 6 sets venn diagram for python
License: The Unlicense
2 ~ 6 sets venn diagram for python
License: The Unlicense
Hey,
so after using venn4()
I am getting the following warning message:
UserWarning: venn4() is retained for backwards compatibility; use venn() instead
Any ideas why this happens and how to fix it?
Is there a way to get the lists of items which overlap between the lists (A only, B only, C only, AB, AC, BC, ABC and like such)?
Thanks!
I want to render this on a react application.How do I do it?
Hi there,
I found that we cannot set 'dpi' as optional argument when calling venn() function.
Best regards,
Chao
Hello,
I'm trying to run the first code lines of the tutorial:
import matplotlib
matplotlib.use('Agg')
import venn
labels = venn.get_labels([
range(10),
range(5, 15)
], fill=['number', 'logic'])
print labels
fig, ax = venn.venn2(labels, names=['list 1', 'list 2'])
fig.show()
And I recibe this error:
/usr/local/lib/python2.7/dist-packages/matplotlib/figure.py:459: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure
"matplotlib is currently using a non-GUI backend, "
Do you know what is the problem and how to solve it?
I got this error:
File "/opt/mypython/local/lib/python2.7/site-packages/venn/_venn.py", line 101
def draw_venn(*, petal_labels, dataset_labels, hint_hidden, colors, figsize, fontsize, legend_loc, ax):
^
SyntaxError: invalid syntax
It seems there is a problem in the asterisk sign
Hi,
After cloning the git and trying to import venn.py, I get the following error message:
-bash: cd: source: No such file or directory (lsl) [tomasfly@access2 pyvenn]$ import threading Traceback (most recent call last): File "/apps/RH7U2/gnu/python/3.6.0/bin/import", line 11, in <module> load_entry_point('import==0.1.0', 'console_scripts', 'import')() File "/apps/RH7U2/gnu/python/3.6.0/lib/python3.6/site-packages/pkg_resources/__init__.py", line 572, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/apps/RH7U2/gnu/python/3.6.0/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2755, in load_entry_point return ep.load() File "/apps/RH7U2/gnu/python/3.6.0/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2408, in load return self.resolve() File "/apps/RH7U2/gnu/python/3.6.0/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2414, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/apps/RH7U2/gnu/python/3.6.0/lib/python3.6/site-packages/import.py", line 3 print('This is ultran00b's package - import') ^ SyntaxError: invalid syntax
any advice?
Thanks
I'm sure there is probably a way to do it using some combination of pyplot commands, but given this comes up quite a bit for venn diagrams, it would be nice if there was a clean way to specify labels and counts for the null-combination of classes. For example, the venn2 function should be able to cleanly handle input like...
labels = {"00": 2, "01": 5, "10": 5, "11": 10}
fig, ax = venn.venn2(labels, names=['list 1', 'list 2'])
and it should document the fact that their are 2 data points that aren't in list 1 or list 2 somewhere on the resultant figure. For now my easiest sollution to this is to just use pyplot.text and manually create the label for the category, but this is clunky. Another arguably less clunky sollution is to create the null category as a new label type and do something like...
labels = {"001": 2, "010": 5, "100": 5, "110": 10}
fig, ax = venn.venn3(labels, names=['list 1', 'list 2', "neither"])
I don't like this sollution though as it adds a false dimension to the data creating lots of positions where it seems like a count should exist but doesn't. ("111" for example)
The ideal sollution would both add the label for the 00* category to the legend and provide the ability to label the whitespace with the relevant count and name. This would probably require adding a keyword argument to the vennK functions to make them into something like.
def venn2(labels, names=['A', 'B'], null_name="None", **options):
EDIT: Played with it some more. Here is a way to add "null" labels to venn diagrams at the moment for anyone reading this. Would be nice if something like this became default behavior though or could easily be done through the use of an optional argument like "null_name" above
# names = some list of label names
# labels = dict mapping label combinations to counts as usual
fig, ax = venn2(labels, names)
# remake legend with null label
ax.plot([], color="white")
legend_null_label = "neither : 2"
ax.legend( [legend_null_label] + names, loc='center left', bbox_to_anchor=(1.0, 0.5), fancybox=True)
# optionally add the information somewhere on the figure
ax.text(0.95, 0.4, legend_null_label)
Can I fill all data values instead of numbers?
hello,i meet a problem that it can not show label name beside venn using your example code. is there any parameter to set to show the label name beside each set int the venn plot.
I'd be happy to help with this one!
I'm trying the first line of the tutorial but get a typerror
. See below:
import venn
import matplotlib
matplotlib.use('Agg')
labels = venn.get_labels([range(10),range(5, 15)], fill=['number', 'logic'])
TypeError Traceback (most recent call last)
<ipython-input-151-0893ce4030bb> in <module>
4
5
----> 6 labels = venn.get_labels([range(10),range(5, 15)], fill=['number', 'logic'])
~\Anaconda3\lib\site-packages\venn\_backwards_compatibility.py in get_labels(data, fill)
24 if "percent" in fill:
25 fmt += "({percentage:.1f}%)"
---> 26 return generate_petal_labels(data, fmt)
27
28 def vennx(labels, names, colors=OLD_COLORS, figsize=(9, 9), dpi=None, fontsize=14):
~\Anaconda3\lib\site-packages\venn\_venn.py in generate_petal_labels(datasets, fmt)
58 datasets = list(datasets)
59 n_sets = len(datasets)
---> 60 dataset_union = set.union(*datasets)
61 universe_size = len(dataset_union)
62 petal_labels = {}
TypeError: descriptor 'union' requires a 'set' object but received a 'range'
This project has no license, this means that it cannot even be redistributed without the consent of the author.
You may want to pick an appropriate license (better if Free Software or Open Source) and put a LICENSE.md file with the terms in the repository.
Is it possible to make this code Python 3.7 compatible?
sir, can you please help me to build this system even I have code everything but I don't know to start from the beginning
I cloned the repo, cd
'd in, typed python3
and hit enter. I tried importing venn, and the following happened:
>>> import venn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/my/path/pyvenn/venn.py", line 3, in <module> from collections import Iterable
ImportError: cannot import name 'Iterable' from 'collections' (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/collections/__init__.py)
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.