forked from tctianchi/pyvenn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,68 @@ | ||
# pyvenn | ||
2 ~ 6 Sets Venn Diagram For Python | ||
|
||
Use magic function in ipython notebook: | ||
```python | ||
%matplotlib inline | ||
|
||
import venn | ||
``` | ||
|
||
Or using non-interactive backend: | ||
```python | ||
import matplotlib | ||
matplotlib.use('Agg') | ||
|
||
import venn | ||
``` | ||
|
||
Fetch labels of each subset in venn diagram. The input data is an array of iterable data(list, set, etc.). | ||
```python | ||
In [5]: labels = venn.get_labels([ | ||
range(10), | ||
range(5, 15) | ||
], fill=['number', 'logic']) | ||
In [6]: print labels | ||
Out [6]: {'01': '01: 5', '10': '10: 5', '11': '11: 5'} | ||
``` | ||
|
||
And plot: | ||
```python | ||
fig, ax = venn.venn2(labels, names=['list 1', 'list 2']) | ||
fig.show() | ||
``` | ||
|
||
 | ||
|
||
More examples: | ||
```python | ||
labels = venn.get_labels([range(10), range(5, 15), range(3, 8)], fill=['number', 'logic']) | ||
fig, ax = venn.venn3(labels, names=['list 1', 'list 2', 'list 3']) | ||
fig.show() | ||
``` | ||
|
||
 | ||
|
||
```python | ||
labels = venn.get_labels([range(10), range(5, 15), range(3, 8), range(8, 17)], fill=['number', 'logic']) | ||
fig, ax = venn.venn4(labels, names=['list 1', 'list 2', 'list 3', 'list 4']) | ||
fig.show() | ||
``` | ||
|
||
 | ||
|
||
```python | ||
labels = venn.get_labels([range(10), range(5, 15), range(3, 8), range(8, 17), range(10, 20)], fill=['number', 'logic']) | ||
fig, ax = venn.venn5(labels, names=['list 1', 'list 2', 'list 3', 'list 4', 'list 5']) | ||
fig.show() | ||
``` | ||
|
||
 | ||
|
||
```python | ||
labels = venn.get_labels([range(10), range(5, 15), range(3, 8), range(8, 17), range(10, 20), range(13, 25)], fill=['number', 'logic']) | ||
fig, ax = venn.venn6(labels, names=['list 1', 'list 2', 'list 3', 'list 4', 'list 5', 'list 6']) | ||
fig.show() | ||
``` | ||
|
||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters