plot_functions.py
def pick_anchors_informations(anchors, x_min=-10, width=20, y_min=-10, height=20, compute=False):
    """
    Function to store information about the anchors and return the position and size to draw the anchors
    Anchors is of the form : "2 < x <= 7, -5 > y" or any rule
    """
    regex = re.compile(r"([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)")
    if len(anchors) == 0:
        return x_min, y_min, width, height
    elif len(anchors) == 1:
        if "x" in anchors[0]:
            x_bounds = regex.findall(anchors[0])
            x_min = min(float(x) for x in x_bounds)
            if len(x_bounds) == 1:
                width = (-width if "<" in anchors[0] else width)
            else:
                width = max(float(x) for x in x_bounds) - min(float(y) for y in x_bounds)
        else:
            y_bounds = regex.findall(anchors[0])
            y_min = min(float(y) for y in y_bounds)
            if len(y_bounds) == 1:
                height = (-height if "<" in anchors[0] else height)
            else:
                height = max(float(y) for y in y_bounds) - min(float(x) for x in y_bounds)

    else:
        if "x" in anchors[0]:
            x_bounds = regex.findall(anchors[0])
            x_min = min(float(x) for x in x_bounds)
            if len(x_bounds) == 1:
                width = (-width if "<" in anchors[0] else width)
            else:
                width = max(float(x) for x in x_bounds) - min(float(y) for y in x_bounds)
            y_bounds = regex.findall(anchors[1])
            y_min = min(float(y) for y in y_bounds)
            if len(y_bounds) == 1:
                height = (-height if "<" in anchors[1] else height)
            else:
                height = max(float(y) for y in y_bounds) - min(float(x) for x in y_bounds)
        else:
            y_bounds = regex.findall(anchors[0])
            y_min = min(float(y) for y in y_bounds)
            if len(y_bounds) == 1:
                height = (-height if "<" in anchors[0] else height)
            else:
                height = max(float(y) for y in y_bounds) - min(float(x) for x in y_bounds)
            x_bounds = regex.findall(anchors[1])
            x_min = min(float(x) for x in x_bounds)
            if len(x_bounds) == 1:
                width = (-width if "<" in anchors[1] else width)
                print(width)
            else:
                width = max(float(x) for x in x_bounds) - min(float(y) for y in x_bounds)
    return x_min, y_min, width, height

    Function to store information about the anchors and return the position and size to draw the anchors
    Anchors is of the form : "2 < x <= 7, -5 > y" or any rule
    
Function to store information about the anchors and return the position and size to draw the anchors
Anchors is of the form : "2 < x <= 7, -5 > y" or any rule
Function to store information about the anchors and return the position and size to draw the anchors Anchors is of the form : " 2 < x < = 7 - 5 > y " or any rule
def pick_anchors_informations(anchors, x_min=-10, width=20, y_min=-10, height=20, compute=False):
    regex = re.compile(r"([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)")
    if len(anchors) == 0:
        return x_min, y_min, width, height
    elif len(anchors) == 1:
        if "x" in anchors[0]:
            x_bounds = regex.findall(anchors[0])
            x_min = min(float(x) for x in x_bounds)
            if len(x_bounds) == 1:
                width = (-width if "<" in anchors[0] else width)
            else:
                width = max(float(x) for x in x_bounds) - min(float(y) for y in x_bounds)
        else:
            y_bounds = regex.findall(anchors[0])
            y_min = min(float(y) for y in y_bounds)
            if len(y_bounds) == 1:
                height = (-height if "<" in anchors[0] else height)
            else:
                height = max(float(y) for y in y_bounds) - min(float(x) for x in y_bounds)
    else:
        if "x" in anchors[0]:
            x_bounds = regex.findall(anchors[0])
            x_min = min(float(x) for x in x_bounds)
            if len(x_bounds) == 1:
                width = (-width if "<" in anchors[0] else width)
            else:
                width = max(float(x) for x in x_bounds) - min(float(y) for y in x_bounds)
            y_bounds = regex.findall(anchors[1])
            y_min = min(float(y) for y in y_bounds)
            if len(y_bounds) == 1:
                height = (-height if "<" in anchors[1] else height)
            else:
                height = max(float(y) for y in y_bounds) - min(float(x) for x in y_bounds)
        else:
            y_bounds = regex.findall(anchors[0])
            y_min = min(float(y) for y in y_bounds)
            if len(y_bounds) == 1:
                height = (-height if "<" in anchors[0] else height)
            else:
                height = max(float(y) for y in y_bounds) - min(float(x) for x in y_bounds)
            x_bounds = regex.findall(anchors[1])
            x_min = min(float(x) for x in x_bounds)
            if len(x_bounds) == 1:
                width = (-width if "<" in anchors[1] else width)
                print(width)
            else:
                width = max(float(x) for x in x_bounds) - min(float(y) for y in x_bounds)
    return x_min, y_min, width, height
def pick_anchors_informations ( anchors , x_min = - 10 , width = 20 , y_min = - 10 , height = 20 , compute = False ) : regex = re . compile ( r"([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)" ) if len ( anchors ) == 0 : return x_min , y_min , width , height elif len ( anchors ) == 1 : if "x" in anchors [ 0 ] : x_bounds = regex . findall ( anchors [ 0 ] ) x_min = min ( float ( x ) for x in x_bounds ) if len ( x_bounds ) == 1 : width = ( - width if "<" in anchors [ 0 ] else width ) else : width = max ( float ( x ) for x in x_bounds ) - min ( float ( y ) for y in x_bounds ) else : y_bounds = regex . findall ( anchors [ 0 ] ) y_min = min ( float ( y ) for y in y_bounds ) if len ( y_bounds ) == 1 : height = ( - height if "<" in anchors [ 0 ] else height ) else : height = max ( float ( y ) for y in y_bounds ) - min ( float ( x ) for x in y_bounds ) else : if "x" in anchors [ 0 ] : x_bounds = regex . findall ( anchors [ 0 ] ) x_min = min ( float ( x ) for x in x_bounds ) if len ( x_bounds ) == 1 : width = ( - width if "<" in anchors [ 0 ] else width ) else : width = max ( float ( x ) for x in x_bounds ) - min ( float ( y ) for y in x_bounds ) y_bounds = regex . findall ( anchors [ 1 ] ) y_min = min ( float ( y ) for y in y_bounds ) if len ( y_bounds ) == 1 : height = ( - height if "<" in anchors [ 1 ] else height ) else : height = max ( float ( y ) for y in y_bounds ) - min ( float ( x ) for x in y_bounds ) else : y_bounds = regex . findall ( anchors [ 0 ] ) y_min = min ( float ( y ) for y in y_bounds ) if len ( y_bounds ) == 1 : height = ( - height if "<" in anchors [ 0 ] else height ) else : height = max ( float ( y ) for y in y_bounds ) - min ( float ( x ) for x in y_bounds ) x_bounds = regex . findall ( anchors [ 1 ] ) x_min = min ( float ( x ) for x in x_bounds ) if len ( x_bounds ) == 1 : width = ( - width if "<" in anchors [ 1 ] else width ) print ( width ) else : width = max ( float ( x ) for x in x_bounds ) - min ( float ( y ) for y in x_bounds ) return x_min , y_min , width , height
Function to store information about the anchors and return the position and size to draw the anchors
Anchors is of the form : "2 < x <= 7, -5 > y" or any rule
Function to store information about the anchors and return the position and size to draw the anchors Anchors is of the form : " 2 < x < = 7 - 5 > y " or any rule
"""
    Function to store information about the anchors and return the position and size to draw the anchors
    Anchors is of the form : "2 < x <= 7, -5 > y" or any rule
    """
anchors
x_min
width
y_min
height
compute