neuralib.plot.venn

class neuralib.plot.venn.VennHandler[source]

VennHandler(subset_a, subset_b, subset_overlap, total_set)

subset_a: int

whole number with condition a

subset_b: int

whole number with condition b

subset_overlap: int

whole number with condition a & b

total_set: int | None

Alias for field number 3

property chance_level: float
with_total(total)[source]

total set number. should include the non-classified population

Parameters:

total (int)

Return type:

VennHandler

get_pure_number()[source]
Return type:

tuple[int, …]

get_pure_fraction()[source]
Return type:

tuple[float, …]

static __new__(_cls, subset_a, subset_b, subset_overlap, total_set=None)

Create new instance of VennHandler(subset_a, subset_b, subset_overlap, total_set)

Parameters:
  • subset_a (int)

  • subset_b (int)

  • subset_overlap (int)

  • total_set (Optional[int])

class neuralib.plot.venn.VennDiagram[source]
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 | bytes | BinaryIO | BufferedIOBase | BufferedReader) – fig output

property title: str

title of the plot