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) –
Axeskwargs – additional args passed to
matplotlib_venn.venn2()ormatplotlib_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
Add intersection value into subsets
Attributes
intersection for sets
set names
maximal number of intersection areas
percentage of each subset
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) –
Axeskwargs – additional args passed to
matplotlib_venn.venn2()ormatplotlib_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_intersection(*label)[source]
Get intersection value from labels
:param label:i.e., a & b :return: intersection value
- Parameters:
label (str)
- Return type:
int
- plot(add_title=True)[source]
Plot the venn diagram
- Parameters:
add_title (bool) – Add percentage information and total as title
- static savefig(output)[source]
Save figure
- Parameters:
output (str | Path | PathLike[str]) – fig output
- property title: str
title of the plot