neuralib.plot.venn.VennDiagram

class neuralib.plot.venn.VennDiagram[source]

Bases: object

__init__(subsets, *, colors=None, ax=None, **kwargs)[source]
Parameters:
  • subsets (dict[str, int]) – Dictionary of set label and its value

  • colors (tuple[str, ...] | None) – colors of each venn

  • ax (Axes | None) – Axes

  • kwargs – additional args passed to matplotlib_venn.venn2() or matplotlib_venn.venn3()

Methods

__init__(subsets, *[, colors, ax])

add_intersection(group, value)

Add intersection values using "&"

add_total(value)

Add total value to the venn diagram :param value: value to be added

get_chance_level(*label)

get_intersection(*label)

Get intersection value from labels

plot([add_title])

Plot the venn diagram

savefig(output)

Save figure

show()

Show figure

with_intersection()

Add intersection value into subsets

Attributes

DEFAULT_COLORS

intersections

intersection for sets

labels

set names

max_intersection_areas

maximal number of intersection areas

subsets_percentage

percentage of each subset

title

title of the plot

DEFAULT_COLORS: ClassVar[tuple[str, ...]] = ('r', 'g', 'b')
__init__(subsets, *, colors=None, ax=None, **kwargs)[source]
Parameters:
  • subsets (dict[str, int]) – Dictionary of set label and its value

  • colors (tuple[str, ...] | None) – colors of each venn

  • ax (Axes | None) – Axes

  • kwargs – additional args passed to matplotlib_venn.venn2() or matplotlib_venn.venn3()

property intersections: dict[str, int]

intersection for sets

property max_intersection_areas

maximal number of intersection areas

property labels: tuple[str, ...]

set names

property subsets_percentage: dict[str, float]

percentage of each subset

add_total(value)[source]

Add total value to the venn diagram :param value: value to be added

Parameters:

value (int)

add_intersection(group, value)[source]

Add intersection values using “&”

Parameters:
  • group (str) – i.e., a & b

  • value (int) – value of the intersection

get_chance_level(*label)[source]
Return type:

float

get_intersection(*label)[source]

Get intersection value from labels

:param label:i.e., a & b :return: intersection value

Parameters:

label (str)

Return type:

int

with_intersection()[source]

Add intersection value into subsets

plot(add_title=True)[source]

Plot the venn diagram

Parameters:

add_title (bool) – Add percentage information and total as title

static show()[source]

Show figure

static savefig(output)[source]

Save figure

Parameters:

output (str | Path | PathLike[str]) – fig output

property title: str

title of the plot