Venn (interactive)

The same area-proportional Euler layout as Venn (static), rendered in Plotly with members shown on hover.

source

eunoia_venn_interactive

def eunoia_venn_interactive(
    dfs, colors, style:str='round', title:str='', opacity:float=0.5, count_size:int=14, count_color:NoneType=None,
    title_size:int=20, name_size:int=16, width:int=760, height:int=680, show_counts:bool=True, hover_size:int=13,
    hit_size:int=34, save_path:NoneType=None
):

Call self as a function.

Data

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")

Interactive Venn / Euler

Hover any region to list its members; counts and single-set names are drawn in place.

eunoia_venn_interactive([ibu, acet], colors="Set1", width=740, height=560, title="Ibuprofen vs Acetaminophen targets")
eunoia_venn_interactive([flu, ibu, acet], colors="Set1", width=760, height=640, title="Targets of Fluoxetine, Ibuprofen, Acetaminophen")

Controlling plot aesthetics

Argument Controls
style "round" or "box", as in the static version
colors list of colours, or a colormap name
title, title_size figure title text and size
count_size font size of the in-region count numbers
count_color colour of the counts; pass e.g. "black" to override the default darkened blend
name_size font size of the set names outside each shape
opacity fill opacity of the shapes
hover_size font size of the member list in the hover tooltip
show_counts draw the counts in place (True) or leave members to hover only
width, height figure size in pixels
save_path optional path to save a standalone HTML file

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.