# UpSet (static)


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

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

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

### upset

``` python
def upset(
    data_dict, color_list:NoneType=None, bar_width:float=0.8, totals_bar_height:float=0.6, matrix_height:float=1.0,
    intersection_plot_elements:int=6, totals_plot_elements:int=2, circle_size:int=100, gridkey_fontsize:int=13,
    axis_fontsize:int=13, fontsize:NoneType=None, count_fontsize:int=12, count_color:NoneType=None,
    min_fontsize:int=6, max_fontsize:int=20, figsize:NoneType=None, font:str='Inter', sort_by:str='cardinality',
    wspace:int=0, hspace:int=0, title:str='', title_fontsize:int=20, title_fontweight:str='bold',
    save_path:NoneType=None
):
```

*Call self as a function.*

## Data

UpSet takes a plain `{name: [members]}` dict.

``` python
drugbase = ("Drug target sample files/" if __import__("os").path.isdir("Drug target sample files") else "../Drug target sample files/")
flu = pd.read_csv(drugbase + "1. FLUOXETINE_sample.csv")["Gene names"].dropna().tolist()
ibu = pd.read_csv(drugbase + "2. IBUPROFEN_sample.csv")["Gene names"].dropna().tolist()
acet = pd.read_csv(drugbase + "3. ACETAMINOPHEN_sample.csv")["Gene names"].dropna().tolist()
```

## Static UpSet

``` python
upset({"Fluoxetine": flu, "Ibuprofen": ibu, "Acetaminophen": acet}, figsize=(11, 6), color_list="Set2", wspace=0.55)
```

![](06_upset_files/figure-commonmark/cell-4-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>color_list</code></td>
<td>list of bar colours, or a colormap name (e.g. <code>"Set2"</code>);
one per intersection bar</td>
</tr>
<tr>
<td><code>title</code>, <code>title_fontsize</code></td>
<td>figure title text and size</td>
</tr>
<tr>
<td><code>count_color</code>, <code>count_fontsize</code></td>
<td>colour and size of the count above each bar (default colour: a
darkened bar colour)</td>
</tr>
<tr>
<td><code>fontsize</code></td>
<td>force a fixed member font (default: auto-fit to the bars)</td>
</tr>
<tr>
<td><code>min_fontsize</code>, <code>max_fontsize</code></td>
<td>bounds for the automatic font search</td>
</tr>
<tr>
<td><code>circle_size</code></td>
<td>size of the dot-matrix markers</td>
</tr>
<tr>
<td><code>gridkey_fontsize</code>, <code>axis_fontsize</code></td>
<td>font sizes of the set names and the axes</td>
</tr>
<tr>
<td><code>bar_width</code>, <code>totals_bar_height</code></td>
<td>thickness of the intersection and set-total bars</td>
</tr>
<tr>
<td><code>sort_by</code></td>
<td>order bars by <code>"cardinality"</code> or
<code>"degree"</code></td>
</tr>
<tr>
<td><code>wspace</code>, <code>hspace</code></td>
<td>spacing between the panels</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 `color_list`;
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.
