Skip to content

visual_utils

canvas_creation(layout)

the canvas task taking as input the starting task POs and output the fig and grid

Source code in exe_kg_lib/utils/task_utils/visual_utils.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def canvas_creation(layout: str) -> Tuple[Figure, Optional[plt.GridSpec]]:
    """the canvas task taking as input the starting task POs and output the fig and grid"""

    font = FontProperties()
    font.set_size(10)
    font.set_name("Verdana")

    try:
        n_rows, n_cols = (int(i) for i in layout[0].split(" "))
    except:
        n_rows, n_cols = (1, 1)

    fig = plt.figure(figsize=(7, 5))

    grid = None if (n_rows == n_cols and n_rows == 1) else plt.GridSpec(n_rows, n_cols, hspace=0.3, wspace=0.3)

    return fig, grid

Last update: October 20, 2023