File: _util.py

package info (click to toggle)
python-matplotlib-venn 1.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 340 kB
  • sloc: python: 1,514; makefile: 8
file content (75 lines) | stat: -rw-r--r-- 2,089 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
"""
Venn diagram plotting routines.
Utility routines

Copyright 2012-2024, Konstantin Tretyakov.
http://kt.era.ee/

Licensed under MIT license.
"""

import warnings
from matplotlib_venn._venn2 import venn2
from matplotlib_venn._venn3 import venn3
from matplotlib_venn.layout.venn2 import DefaultLayoutAlgorithm as Venn2Layout
from matplotlib_venn.layout.venn3 import DefaultLayoutAlgorithm as Venn3Layout


def venn2_unweighted(
    subsets,
    set_labels=("A", "B"),
    set_colors=("r", "g"),
    alpha=0.4,
    normalize_to=1.0,
    subset_areas=(1, 1, 1),
    ax=None,
    subset_label_formatter=None,
):
    """
    This function is deprecated and will be removed in a future version.
    Use venn2(..., layout_algorithm=matplotlib_venn.layout.venn2.DefaultLayoutAlgorithm(fixed_subset_sizes=(1,1,1))) instead.
    """
    warnings.warn(
        "venn2_unweighted is deprecated. Use venn2 with the appropriate layout_algorithm instead."
    )
    return venn2(
        subsets,
        set_labels,
        set_colors,
        alpha,
        ax,
        subset_label_formatter=subset_label_formatter,
        layout_algorithm=Venn2Layout(
            normalize_to=normalize_to, fixed_subset_sizes=subset_areas
        ),
    )


def venn3_unweighted(
    subsets,
    set_labels=("A", "B", "C"),
    set_colors=("r", "g", "b"),
    alpha=0.4,
    normalize_to=1.0,
    subset_areas=(1, 1, 1, 1, 1, 1, 1),
    ax=None,
    subset_label_formatter=None,
):
    """
    This function is deprecated and will be removed in a future version.
    Use venn3(..., layout_algorithm=matplotlib_venn.layout.venn3.DefaultLayoutAlgorithm(fixed_subset_sizes=(1,1,1,1,1,1,1))) instead.
    """
    warnings.warn(
        "venn3_unweighted is deprecated. Use venn3 with the appropriate layout_algorithm instead."
    )
    return venn3(
        subsets,
        set_labels,
        set_colors,
        alpha,
        ax,
        subset_label_formatter=subset_label_formatter,
        layout_algorithm=Venn3Layout(
            normalize_to=normalize_to, fixed_subset_sizes=subset_areas
        ),
    )