https://github.com/michabirklbauer/venn
Wrapper for quick venn diagrams with matplotlib-venn
https://github.com/michabirklbauer/venn
matplotlib python venn-diagram
Last synced: 2 months ago
JSON representation
Wrapper for quick venn diagrams with matplotlib-venn
- Host: GitHub
- URL: https://github.com/michabirklbauer/venn
- Owner: michabirklbauer
- License: mit
- Created: 2023-01-27T14:51:30.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-01-30T19:13:49.000Z (about 2 years ago)
- Last Synced: 2025-01-04T07:52:45.139Z (4 months ago)
- Topics: matplotlib, python, venn-diagram
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Quick Venn Diagrams
A wrapper to create venn diagrams quickly with [matplotlib-venn](https://github.com/konstantint/matplotlib-venn) in python using sets as input and some pre-configured aesthetics that I commonly use.
## Requirements
Requires [matplotlib](https://matplotlib.org/) and [matplotlib-venn](https://github.com/konstantint/matplotlib-venn).
```
pip install -r requirements.txt
```## Usage
```python
from venn import vennset_1 = {"A", "B", "C", "D"}
set_2 = {"C", "D", "E", "F"}
set_3 = {"D", "G", "H", "I"}# 2 set venn diagram
fig_1 = venn(set_1, set_2)
# 3 set venn diagram
fig_2 = venn(set_1, set_2, set_3)
```Function `venn` documentation:
```python
def venn(set_1: set,
set_2: set,
set_3: set = None,
labels: List[str] = ["Set 1", "Set 2", "Set 3"],
colors: List[str] = ["#4361EE", "#4CC9F0", "#F72585"],
alpha: float = 0.6,
contour: bool = False,
linewidth: float = 0.5,
title: str = "Venn Diagram",
filename: str = None) -> plt.figure:"""
DESCRIPTION
Wrapper with some defaults that I use for creating venn diagrams with the
matplotlib-venn package (https://github.com/konstantint/matplotlib-venn).PARAMETERS:
set_1: set
first set of the venn diagram
set_2: set
second set of the venn diagram
set_3: set
[Optional]
if specified a three set venn diagram will be drawn, if not specified
the two set venn diagram of set_1 and set_2 will be drawn
DEFAULT: None
labels: List[str]
[Optional]
list of labels for the sets
DEFAULT: ["Set 1", "Set 2", "Set 3"]
colors: List[str]
[Optional]
list of valid matplotlib colors to use for the venn circles
DEFAULT: ["#4361EE", "#4CC9F0", "#F72585"]
alpha: float
[Optional]
color opacity
DEFAULT: 0.6
contour: bool
[Optional]
if contour should be drawn around venn circles
DEFAULT: False
linewidth: float
[Optional]
linewidth of the contour
DEFAULT: 0.5
title: str
[Optional]
title of the figure
DEFAULT: "Venn Diagram"
filename: str
[Optional]
if given the venn diagram will be saved at the specified location in
.png and .svg format with and without title
DEFAULT: NoneRETURNS:
plt.figure
matplotlib figure object of the created venn diagram
"""
```## License
- [MIT](https://github.com/michabirklbauer/venn/blob/master/LICENSE)
## Contact
- [[email protected]](mailto:[email protected])