# Venn (static)


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

------------------------------------------------------------------------

<a href="https://github.com/mnicolee/VISET/blob/main/viset/venn.py#L126"
target="_blank" style="float:right; font-size:smaller">source</a>

### eunoia_venn

``` python
def eunoia_venn(
    dfs, colors, style:str='round', fontsize:NoneType=None, inner_label_size:NoneType=None,
    outer_label_size:NoneType=None, title_size:NoneType=None, font:str='Inter', fontcolor:str='black',
    count_color:NoneType=None, title:str='', num_cols:NoneType=None, gutter:int=2, margin:float=0.03,
    min_fontsize:int=6, max_fontsize:int=40, grid:int=380, seed:int=0, figsize:NoneType=None,
    save_path:NoneType=None
):
```

*Call self as a function.*

## Data

``` python
drugbase = ("Drug target sample files/" if __import__("os").path.isdir("Drug target sample files") else "../Drug target sample files/")
flu = load(drugbase + "1. FLUOXETINE_sample.csv", "Gene names", "Fluoxetine")
ibu = load(drugbase + "2. IBUPROFEN_sample.csv", "Gene names", "Ibuprofen")
acet = load(drugbase + "3. ACETAMINOPHEN_sample.csv", "Gene names", "Acetaminophen")
```

## Static Venn / Euler

Round style (circle for 2 sets, ellipse for 3), members auto-fit inside
each region.

``` python
eunoia_venn([ibu, acet], colors="Set1", figsize=(8, 6.5), title="Ibuprofen vs Acetaminophen targets")
```

![](04_venn_files/figure-commonmark/cell-4-output-1.png)

``` python
eunoia_venn([flu, ibu, acet], colors="Set1", figsize=(9, 8), title="Targets of Fluoxetine, Ibuprofen, Acetaminophen")
```

![](04_venn_files/figure-commonmark/cell-5-output-1.png)

``` python
import sys, viset.venn as v, inspect
print(sys.executable)
print(v.__file__)
print("has fix:", "closest to the region centroid" in inspect.getsource(v._max_font_rect))
```

    /opt/hostedtoolcache/Python/3.11.15/x64/bin/python
    /home/runner/work/VISET/VISET/viset/venn.py
    has fix: True

VISET also has a **box** style (`style="box"` — squares for two sets,
rectangles for three). As the [Introduction](index.html) explains,
rectangles *can* make all seven regions of a three-set diagram exactly
area-proportional, but eunoia packs them tightly, so the itemised member
lists have little room and read poorly. The **round** (ellipse) style
shown above is recommended whenever you want the member names inside the
regions; use `style="box"` mainly for the area-exact shapes themselves.

``` python
eunoia_venn([flu, ibu, acet], colors="Set1", figsize=(9, 8), style = "box", title="Targets of Fluoxetine, Ibuprofen, Acetaminophen")
```

![](04_venn_files/figure-commonmark/cell-7-output-1.png)

## Controlling plot aesthetics

<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<thead>
<tr>
<th>Argument</th>
<th>Controls</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>style</code></td>
<td><code>"round"</code> (circle for 2 sets, ellipse for 3) or
<code>"box"</code> (square / rectangle)</td>
</tr>
<tr>
<td><code>colors</code></td>
<td>list of colours, or a Matplotlib colormap name
(e.g. <code>"Set1"</code>, <code>"Dark2"</code>)</td>
</tr>
<tr>
<td><code>title</code>, <code>title_size</code></td>
<td>figure title text and size</td>
</tr>
<tr>
<td><code>count_color</code></td>
<td>colour of the intersection <strong>count</strong> numbers (default:
a darkened blend of the region’s set colours)</td>
</tr>
<tr>
<td><code>fontcolor</code></td>
<td>colour of the member-name text</td>
</tr>
<tr>
<td><code>outer_label_size</code></td>
<td>font size of the <strong>set names</strong> placed outside each
shape</td>
</tr>
<tr>
<td><code>num_cols</code></td>
<td>force a fixed number of member columns per region (default: chosen
automatically)</td>
</tr>
<tr>
<td><code>fontsize</code></td>
<td>force a fixed member font (default: auto-fit per region)</td>
</tr>
<tr>
<td><code>min_fontsize</code>, <code>max_fontsize</code></td>
<td>bounds for the automatic font search (defaults 6 and 40)</td>
</tr>
<tr>
<td><code>gutter</code></td>
<td>blank spaces between member columns</td>
</tr>
<tr>
<td><code>margin</code></td>
<td>fraction of the fitted box kept clear, so the outline never touches
the text</td>
</tr>
<tr>
<td><code>figsize</code>, <code>save_path</code></td>
<td>figure size, and an optional path to save a 300-dpi PNG</td>
</tr>
</tbody>
</table>

**Colormap names.** Any Matplotlib colormap name works for `colors`;
qualitative maps keep the sets/bars most distinct: `Set1`, `Set2`,
`Set3`, `Dark2`, `Paired`, `Accent`, `Pastel1`, `Pastel2`, `tab10`,
`tab20`. You can also pass an explicit list of colours instead.
